/**
 * Created by sinarts on 17/1/18.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeTree = factory(window.$ || $);
    }
})(this, function($) {
    $.fn.jeTree = function(options) {
        return this.each(function() {
            return new jeTree($(this), options || {});
        });
    };
    $.extend({
        jeTree: function(elem, options) {
            return $(elem).each(function() {
                return new jeTree($(this), options || {});
            });
        }
    });
    var jeTree = function(elem, opts) {
        var config = {
            skin: "je-tree",
            datas: function() {
                return { url: "", type: "GET", dataType: "json", async: true };
            },
            target: "_blank", //是否新选项卡打开（比如节点返回href才有效）
            itemfun: function(val) {}, //点击当前的回调，val：选中的数据
            success: null //加载成功后的回调
        };
        this.opts = $.extend(config, opts || {});
        this.elCell = elem;
        this.init();
    };
    var jefn = jeTree.prototype;
    jefn.init = function() {
        var _this = this,
            opts = _this.opts,
            datas = "";
        //加载数据
        if (typeof opts.ajaxdatasTree == "function") {
            //通过Ajax方式加载数据
            $.ajax(opts.datas()).done(function(json) {
                datas = json;
            });
        } else if (typeof opts.datas == "object") {
            //直接加载数据
            datas = opts.datas;
        }
        //通过数据加载树列表
        var showlist = $("<ul>", { "class": opts.skin });
        _this.datatree(datas, showlist);
        _this.elCell.append(showlist);

        //加载成功后的回调
        if ($.isFunction(opts.success) || opts.success != ("" || null)) {
            opts.success && opts.success();
        }
    };
    jefn.datatree = function(data, parent) {
        var _this = this;
        $.each(data, function(i, val) {
            //如果有子节点，则遍历该子节点
            if (val.childlist.length > 0) {
                //创建一个子节点li
                var liCls = $("<li treeid='" + val.tid + "'></li>");
                //将li的文本设置好，并马上添加一个空白的ul子节点，并且将这个li添加到父亲节点中
                var ulShow = val.open ? "<ul style='display:block;'></ul>" : "<ul></ul>",
                    shde = val.open ? "folderhide foldershow" : "folderhide";
                liCls.append("<a href='javascript:;' class='" + shde + "'>" + val.name + "</a>").append(ulShow).appendTo(parent);
                //将空白的ul作为下一个递归遍历的父亲节点传入
                _this.datatree(val.childlist, liCls.children("ul"));
            } else {
                //创建一个子节点li
                var liCls = $("<li treeid='" + val.tid + "'></li>");
                //没有子节点的情况
                var urls = (val.url == "" || val.url == undefined) ? "javascript:;" : val.url;
                liCls.append("<a href='" + urls + "' class='folderleaf' title='" + val.name + "' target='" + _this.opts.target + "'>" + val.name + "</a>").appendTo(parent);
            }
            _this.clicktree(liCls, val);
        });
    };
    jefn.clicktree = function(licell, items) {
        var _this = this,
            opts = _this.opts;
        licell.children("a").on("click", function() {
            var that = $(this),
                nextCls = that.next(),
                show = "foldershow";
            //判断点击的是否为展开或收起状态
            if (that.hasClass(show)) {
                that.removeClass(show);
                nextCls.animate({ height: 0 }, 200, function() {
                    $(this).css({ height: "auto", display: "none" });
                });
            } else {
                that.addClass(show);
                //计算当前下一个元素的高度
                var openHeight = nextCls.innerHeight();
                nextCls.css({ display: "block", height: "0" }).animate({ height: openHeight }, 200, function() {
                    $(this).css({ height: "auto" });
                });
            }
            //加载成功后的回调
            if ($.isFunction(opts.itemfun) || opts.itemfun != ("" || null)) {
                opts.itemfun && opts.itemfun(items);
            }
        })
    };
    return jeTree;
});


;
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeTabs = factory(window.$ || $);
    }
})(this, function($) {
    //点击切换Tabs选项卡面板
    var tabClick = function(elem, opts) {
            var curr = opts.currCls,
                headCell = elem.find(opts.titCls).children(),
                conCell = elem.find(opts.conCls).children();
            headCell.on(opts.trigger, function() {
                var jthis = $(this),
                    idx = jthis.index();
                jthis.addClass(curr).siblings().removeClass(curr);
                conCell.eq(idx).addClass(curr).siblings().removeClass(curr);
            })
        }
        //创建Tabs选项卡
    var createTabPane = function(opts, isclose) {
            var curr = opts.currCls,
                headCell = opts.elem.find(opts.titCls),
                conCell = opts.elem.find(opts.conCls);
            headCell.children().removeClass(curr);
            conCell.children().removeClass(curr);
            //创建新元素
            var lis = $("<" + opts.litag + "/>", { "class": curr }),
                divs = $("<" + opts.contag + "/>", { "class": opts.childCls }).addClass(curr);
            var close = isclose ? $('<em/>', { "class": "close" }) : "";
            headCell.append(lis.text(opts.title || "").append(close));
            conCell.append(divs.html(opts.content || ""));
            //判断是否可以关闭Tabs
            if (isclose) {
                close.on("click", function() {
                    var cthis = $(this),
                        tlis = cthis.parent(),
                        concls = conCell.children(),
                        idx = tlis.index();
                    closeTabMove(headCell.children(), concls, tlis, idx, curr);
                })
                tabClick(opts.elem, opts);
            }
        }
        //统一选项卡关闭
    var closeTabMove = function(tit, con, tli, idx, curr) {
        tit.removeClass(curr).eq(idx - 1).addClass(curr);
        con.removeClass(curr).eq(idx - 1).addClass(curr);
        con.eq(idx).remove();
        tli.remove();
    };

    var jeTabs = function(elem, opts) {
        var config = {
            titCls: ".je-tabs-title",
            conCls: ".je-tabs-content",
            childCls: "je-tabs-item",
            currCls: "on", //当前高亮的标识clss
            trigger: "click", //选项卡事件
            isClose: true, //是否开启关闭按钮
            tabIndex: 1, //默认的当前位置索引。1是第一个；表示从第几个开始 
            itemfun: function(elem, index, val) {}, //点击当前的回调，elem：当前Select的ID index：索引 val：选中的值
            success: null //加载成功后的回调
        }
        this.opts = $.extend(config, opts || {});
        this.elCell = $(elem);
        this.inopts = this.init();
        return this;
    };

    var jefn = jeTabs.prototype;
    //初始化Tabs
    jefn.init = function() {
            var that = this,
                opts = that.opts,
                curr = opts.currCls,
                headCell = that.elCell.find(opts.titCls).children(),
                conCell = that.elCell.find(opts.conCls).children();
            headCell.removeClass(curr).eq(opts.tabIndex - 1).addClass(curr);
            conCell.removeClass(curr).eq(opts.tabIndex - 1).addClass(curr);

            var elobj = { elem: that.elCell },
                pli = headCell.prop("tagName") || "li";
            pcon = conCell.prop("tagName") || "div";
            if (headCell.find(".close")[0]) {
                headCell.find(".close").on("click", function() {
                    var cthis = $(this),
                        tlis = cthis.parent(),
                        idx = tlis.index(),
                        titcld = that.elCell.find(opts.titCls).children(),
                        concld = that.elCell.find(opts.conCls).children();
                    closeTabMove(titcld, concld, tlis, idx, curr);
                })
            }
            //切换Tabs
            tabClick(that.elCell, opts);
            return $.extend(true, elobj, opts, { litag: pli, contag: pcon });
        }
        //添加Tabs选项卡面板
    jefn.addTabs = function(arr) {
        var opts = $.extend(this.inopts, arr || {});
        opts.elem.unbind(opts.trigger, tabClick);
        createTabPane(opts, opts.close || true);
    }
    $.fn.jeTabs = function(options) {
        return new jeTabs($(this), options || {});
    };
    $.extend({
        jeTabs: function(elem, options) {
            return new jeTabs(elem, options || {});
        }
    });
    return jeTabs;
});

/**
 * Created by SinArts on 2017/2/11.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeTabPane = factory(window.$ || $);
    }
})(this, function($) {
    var jeTabPane = function(elem, opts) {
        var config = {
            skinCell: "tabpanel", //默认风格
            monitor: 'body', //监视的区域
            menuattr: "[addtab]", //点击标识可以是 ".addtab" 或者 "[addtab]"类型
            firstItem: {}, //默认首页
            maxTabs: 12, //最大显示tab标签数量, 默认最大显示12个标签
            moveSize: 104, //每次最大移动宽度
            currCls: "active", //当前高亮的标识class
            contextmenu: true, //是否启用右键快捷菜单
            menulist: { //右键菜单列表
                refresh: '刷新此标签',
                closeThis: '关闭此标签',
                closeOther: '关闭其他标签',
                closeLeft: '关闭左侧标签',
                closeRight: '关闭右侧标签'
            },
            closefun: null,
            success: null //加载成功后的回调
        };
        this.opts = $.extend(config, opts || {});
        this.elCell = elem;
        this.maxTab = this.opts.maxTabs;
        this.moveSize = this.opts.moveSize;
        //私有属性
        this.tabItem = {};
        this.tabsArr = [];
        this.maxMove = 0;
        this.scrolled = false;
        this.scrollComplete = true;
        this.tabInit();
        this.setTabPos();
    };
    $.fn.jeTabPane = function(options) {
        return this.each(function() {
            return new jeTabPane($(this), options || {});
        });
    };
    $.extend({
        jeTabPane: function(elem, options) {
            return $(elem).each(function() {
                return new jeTabPane($(this), options || {});
            });
        }
    });
    jeTabPane.prototype = {
        /**
         * 初始化tabs
         */
        tabInit: function() {
            var that = this,
                opts = this.opts,
                timers, resizeTimer;
            var TabPane = $("<div>", { "class": opts.skinCell }),
                TabContrlWrap = $("<div>", { "class": "tab-contrlwrap" }),
                TabItemWrap = $("<div>", { "class": "tab-itemwrap" }),
                TabItemMove = $("<ul>", { "class": "tab-itemmove" }),
                TabContent = $("<div>", { "class": "tab-panelcontent" }),
                TabLeftBut = $("<div>", { "class": "tab-leftbtn" }),
                TabRightBut = $("<div>", { "class": "tab-rightbtn" });
            //将内容追加到目标元素中
            that.elCell.html(TabPane.prepend(TabContrlWrap.append(TabItemWrap.append(TabItemMove)).append(TabLeftBut).append(TabRightBut)).append(TabContent));
            //获得DOM
            var TabWrap = that.TabWrap = this.elCell;
            that.tabContrlWrap = TabWrap.find(TabContrlWrap);
            that.tabItemWrap = TabWrap.find(TabItemWrap);
            that.tabItemMove = TabWrap.find(TabItemMove);
            that.tabContent = TabWrap.find(TabContent);
            that.leftCell = TabWrap.find(TabLeftBut).select(function() { return false; });
            that.rightCell = TabWrap.find(TabRightBut).select(function() { return false; });
            //默认显示首页   
            if (typeof opts.firstItem === "object" && !(opts.firstItem instanceof Array)) {
                that.addTab(opts.firstItem);
            }
            //点击栏目标题显示对应标签
            $(opts.monitor).on('click', opts.menuattr, function() {
                var obj = (typeof $(this).data('tab') == 'object') ? $(this).data('tab') : $(this).data();
                that.addTab(obj);
            });
            //左右滚动事件
            that.leftCell.on({
                click: function() {
                    window.clearTimeout(timers);
                    timers = window.setTimeout(function() {
                        that.shiftPosition(1, that.moveSize);
                    }, 200);
                },
                dblclick: function() {
                    window.clearTimeout(timers);
                    that.shiftPosition(1, Math.abs(parseInt(that.tabItemMove.css("margin-left"), 10)));
                }
            });
            that.rightCell.on({
                click: function() {
                    window.clearTimeout(timers);
                    timers = window.setTimeout(function() {
                        that.shiftPosition(0, that.moveSize);
                    }, 200);
                },
                dblclick: function() {
                    window.clearTimeout(timers);
                    that.shiftPosition(0, that.maxMove + parseInt(that.tabItemMove.css("margin-left"), 10));
                }
            });
            $(window).on("resize.tabpanel", function() {
                window.clearTimeout(resizeTimer);
                resizeTimer = window.setTimeout(function() {
                    that.resize();
                }, 300);
            });
            that.showScroll();
            that.setTabPos();
            that.shiftPosition();
            //加载成功后的回调
            if ($.isFunction(opts.success) || opts.success != "" || opts.success != null) {
                opts.success && opts.success();
            }
        },
        /**
         * 添加选项卡
         * @param {Object} tabitem
         */
        addTab: function(tabitem) {
            var that = this,
                isClose = (tabitem.closable == undefined || tabitem.closable == "true" || tabitem.closable == true),
                tabId = tabitem.tab,
                closeType = isClose ? "true" : "false";
            that.url = tabitem.url;
            if (!that.scrollComplete) return;
            if (tabId == undefined || tabId == "") {
                alert(tabitem.text + "的tab不能为空");
                return;
            }
            //判断是否已有tab
            if (that.tabItem[tabId]) {
                that.showTab(tabId);
                return;
            } else if (that.maxTab <= that.tabsArr.length) {
                alert("超出最大个数，不能打开");
                return;
            }
            var tablis = $("<li>", { "id": "tablis-" + tabId, "tabrole": "menu", "taburl": that.url, "tabcell": tabId, "tabclose": closeType, "title": tabitem.text });
            that.tabItemMove.append(tablis.text(tabitem.text));
            tabitem.closable = isClose ? true : false;
            tabitem.closem = $('<em>', { "class": "tab-close" });
            tabitem.content = $('<div>', { "id": "tabcon-" + tabId, "class": "tab-conwrap" });
            tabitem.tabLis = tablis;
            tablis.append(isClose ? tabitem.closem : "");
            that.tabContent.append(tabitem.content);
            //绑定事件
            tabitem.tabLis.on("click", function() {
                that.showTab(tabId);
            });
            that.setTabItem(tabitem);
            //设置前置卡
            tabitem.pretab = that.active;
            //放入数组中
            that.tabsArr.push({ tab: tabId });
            //将tabitem写入对象中
            that.tabItem[tabId] = tabitem;
            //更新
            that.setTabPos();
            that.showScroll();
            //显示
            that.showTab(tabId);
            if (that.opts.contextmenu) {
                //obj上禁用右键菜单
                that.tabItemMove.on('contextmenu', 'li[tabrole=menu]', function(e) {
                    that.setTabMenus($(this), e);
                    return false;
                });
            }
        },
        /**
         * 更新卡，方便使用
         * @param {Object} tabitem 同上Item
         */
        setTabItem: function(tabitem) {
            var that = this;
            //恢复未绑定状态
            tabitem.tabLis.unbind("dblclick");
            //可关闭，增加补丁宽度，绑定关闭事件
            if (tabitem.closable) {
                //已有关闭按钮的话，删除点击事件
                if (tabitem.closem) {
                    tabitem.closem.unbind("click");
                }
                //绑定事件
                tabitem.closem.on("click", function() {
                    that.closeTab(tabitem.tab);
                });
                tabitem.tabLis.on("dblclick", function() {
                    that.closeTab(tabitem.tab);
                });
            } else {
                //如果有关闭按钮，删除关闭按钮
                if (tabitem.closem) {
                    tabitem.closem.remove();
                    delete tabitem["closem"];
                }
            }
            //如果设置了宽度
            if (tabitem.width) {
                //先给LI设置宽度
                tabitem.tabLis.width(tabitem.width);
            }
        },
        /**
         * 显示选项卡
         * @param {string} tabId
         */
        showTab: function(tabId) {
            tabId = this.getItemTab(tabId);
            var tabItem = this.tabItem[tabId],
                tabItemAct = this.tabItem[this.active];
            //是否已经显示
            if (this.active === tabId) return;
            //判断是否有该ID的卡
            if (tabItem) {
                //隐藏active，显示本卡
                if (tabItemAct) {
                    tabItemAct.tabLis.removeClass(this.opts.currCls);
                    tabItemAct.content.removeClass(this.opts.currCls);
                }
                tabItem.tabLis.addClass(this.opts.currCls);
                tabItem.content.addClass(this.opts.currCls);
                this.active = tabId;
                //延迟加载判断是否已加载
                if (tabItem.content.html() === "") {
                    tabItem.content.html("<iframe src='" + this.url + "' scrolling='yes' frameborder='0'></iframe>");
                }
            } else {
                alert("ID not found.");
            }
            this.shiftVisible();
        },
        /**
         * 关闭选项卡
         * @param {string} tabId
         */
        closeTab: function(tabId) {
            var that = this;
            tabId = that.getItemTab(tabId);
            var tabCell = that.tabItem[tabId].tab,
                Pretabs = that.tabItem[tabId].pretab;
            //关闭TAB选项卡
            $("#tablis-" + tabCell).remove();
            $("#tabcon-" + tabCell).remove();
            //删除属性
            delete that.tabItem[tabId];
            for (var i = 0; i < that.tabsArr.length; i++) {
                if (that.tabsArr[i].tab === tabId) {
                    that.tabsArr.splice(i, 1);
                    that.setTabPos();
                    that.showScroll();
                    break;
                }
            }
            //如果被关闭卡就是当前卡
            if (that.active === tabId) {
                //显示前置卡
                if (Pretabs && that.tabItem[Pretabs]) {
                    that.showTab(Pretabs);
                } else if (that.tabsArr.length > 0) {
                    that.showTab(that.getItemObj(0).tab);
                }
            } else {
                //移动到可见
                that.shiftVisible();
            }
            that.setTabPos();
            that.showScroll();
            //关闭后的回调
            if ($.isFunction(that.opts.closefun) || that.opts.closefun != "" || that.opts.closefun != null) {
                that.opts.closefun && that.opts.closefun();
            }
        },
        /**
         * 重设鼠标右键内容
         * @param {string} curr
         * @param {object} mouse
         */
        setTabMenus: function(curr, mouse) {
            var that = this,
                opts = that.opts,
                mtab = curr.attr('tabcell'),
                tablis = $('#tablis-' + mtab),
                currCls = opts.currCls,
                ulCell = that.tabItemMove,
                conCell = that.tabContent,
                menuCell = $('<div>', { 'id': 'tabMenus', 'class': 'tabmenubox' }),
                createMenu = function(elcell, text) {
                    return $('<p>', { 'class': elcell, 'data-right': elcell }).append(text);
                };
            $('#tabMenus').remove();
            //创建右键菜单列表
            var refresh = curr.attr('id') ? createMenu('refresh', opts.menulist.refresh) : '',
                remove = (curr.attr('id') && curr.attr('tabclose') == "true") ? createMenu('remove', opts.menulist.closeThis) : '',
                left = curr.prev('li').attr('id') ? createMenu('remove-left', opts.menulist.closeLeft) : '',
                right = curr.next('li').attr('id') ? createMenu('remove-right', opts.menulist.closeRight) : '';
            //将生成的弹出右键菜单插入到body
            menuCell.css({ 'top': mouse.pageY - 3, 'left': mouse.pageX - 3 }).append(refresh).append(remove).append(createMenu('remove-other', opts.menulist.closeOther)).append(left).append(right);
            $('body').append(menuCell.fadeIn('slow'));
            //执行弹出右键菜单函数
            menuCell.on('click', 'p', function() {
                var mthis = $(this),
                    rmVal = mthis.data("right");
                switch (rmVal) {
                    case 'refresh': //刷新当前
                        if (!tablis.hasClass(curr)) {
                            ulCell.find("li").removeClass(currCls);
                            conCell.find(".tab-conwrap").removeClass(currCls);
                            $("#tablis-" + mtab).addClass(currCls);
                            $("#tabcon-" + mtab).addClass(currCls);
                        }
                        $("#tabcon-" + mtab).empty().append("<iframe src='" + curr.attr('taburl') + "' scrolling='yes' frameborder='0'></iframe>");
                        break;
                    case 'remove': //关闭当前标签
                        that.closeTab(mtab);
                        break;
                    case 'remove-other': //关闭除当前的其他标签
                        var tid = tablis.attr("id");
                        $.each(ulCell.find("li"), function(i, cls) {
                            var rtab = $(cls).attr('tabcell'),
                                rclose = $(cls).attr('tabclose');
                            if (rclose == "true" && tid != $(cls).attr('id')) that.closeTab(rtab);
                        });
                        break;
                    case 'remove-right': //关闭右边的标签
                        $.each(tablis.nextUntil(), function(i, cls) {
                            var rtab = $(cls).attr('tabcell'),
                                rclose = $(cls).attr('tabclose');
                            if (rclose == "true") that.closeTab(rtab);
                        });
                        break;
                    case 'remove-left': //关闭左边的标签
                        $.each(tablis.prevUntil(), function(i, cls) {
                            var rtab = $(cls).attr('tabcell'),
                                rclose = $(cls).attr('tabclose');
                            if (rclose == "true") that.closeTab(rtab);
                        });
                        break;
                }
            });
            //鼠标移开后右键菜单消失
            menuCell.mouseleave(function() {
                $(this).fadeOut('slow', function() {
                    $(this).remove()
                });
            });
            $('body').click(function() {
                menuCell.fadeOut('slow', function() {
                    $(this).remove()
                });
            })
        },
        /**
         * 设置每个卡所在位置，计算最大移动量
         */
        setTabPos: function() {
            var that = this;
            that.maxMove = 0;
            for (var i = 0; i < that.tabsArr.length; i++) {
                that.maxMove += that.tabItem[that.tabsArr[i].tab].tabLis.outerWidth(true);
                that.tabsArr[i].where = that.maxMove;
            }
            if (that.scrolled) {
                //减去左右margin的宽度
                var lbw = that.leftCell.outerWidth(true),
                    rbw = that.rightCell.outerWidth(true) + parseInt(that.tabItemWrap.css("padding-right"), 10);
                that.tabItemWrap.width(that.tabContrlWrap.width() - lbw - rbw);
            } else {
                that.tabItemWrap.width(that.tabContrlWrap.width());
            }
            that.maxMove -= that.tabItemWrap.width();
        },
        /**
         * 显示滚动条
         */
        showScroll: function() {
            //获得最后一个选项卡所在位置
            var that = this,
                lastWhere = that.tabsArr[that.tabsArr.length - 1].where,
                itemScroll = "tab-itemwrap-scroll",
                tabScroll = "tab-scroll";
            //获得控制层的宽度
            var contrlWidth = that.tabContrlWrap.width();
            //超出控制层，并且未显示滚动条
            if (lastWhere > contrlWidth && !that.scrolled) {
                that.tabItemWrap.addClass(itemScroll);
                that.leftCell.addClass(tabScroll);
                that.rightCell.addClass(tabScroll);
                that.scrolled = true;
                that.setTabPos();
            } else if (contrlWidth > lastWhere && that.scrolled) {
                //为超出控制层，并且已显示滚动条
                that.tabItemWrap.removeClass(itemScroll);
                that.leftCell.removeClass(tabScroll);
                that.rightCell.removeClass(tabScroll);
                that.scrolled = false;
                that.setTabPos();
            }
        },
        /**
         * 判断滚动条左右是否可用
         */
        useScroll: function() {
            var that = this,
                Disd = "disabled",
                butDis = "tab-btndisable";
            that.scrollComplete = !that.scrollComplete;
            if (that.scrolled) {
                var itemWrapWhere = parseInt(that.tabItemMove.css("margin-left"), 10);
                if (itemWrapWhere >= 0) {
                    //左不能点击
                    that.leftCell.attr(Disd, true).addClass(butDis);
                    that.rightCell.removeAttr(Disd).removeClass(butDis);
                } else if (Math.abs(itemWrapWhere) >= that.maxMove) {
                    //右不能点击
                    that.leftCell.removeAttr(Disd).removeClass(butDis);
                    that.rightCell.attr(Disd, true).addClass(butDis);
                } else {
                    //全能点击
                    that.leftCell.removeAttr(Disd).removeClass(butDis);
                    that.rightCell.removeAttr(Disd).removeClass(butDis);
                }
            }
        },
        /**
         * 移动
         * @param {string} oper 1|0
         * @param {number} num
         */
        shiftPosition: function(oper, num) {
            var that = this,
                fval = oper == 1 ? "+" : "-";
            if (!that.scrollComplete) return;
            //获得当前位置
            var marLeftPos = parseInt(that.tabItemMove.css("margin-left"), 10);
            //判断+或-
            if (fval === "+") {
                //为0直接返回
                if (marLeftPos === 0) {
                    return;
                } else if (marLeftPos + num > 0) {
                    //加上移动位置后若大于0, 移动量为绝对值
                    num = Math.abs(marLeftPos);
                }
            } else if (fval === "-") {
                //当前位置绝对值+移动量，若大于最大移动量
                if (Math.abs(marLeftPos) + num > that.maxMove) {
                    //移动量为差值（ marLeftPos为负数）
                    num = that.maxMove + marLeftPos;
                }
            }
            //移动量大于0时才执行移动
            if (num > 0) {
                that.scrollComplete = !that.scrollComplete;
                that.tabItemMove.animate({
                    "margin-left": fval + "=" + num
                }, 300, function() {
                    that.useScroll();
                });
            }
        },
        /**
         * 直接移动到合适的可见位置
         */
        shiftVisible: function() {
            //获得move层当前的margin
            var that = this,
                movePos = parseInt(that.tabItemMove.css("margin-left"), 10),
                //获得当前激活卡
                activeTab = that.tabItem[that.active],
                //获得当前激活卡的属性
                activeTabProp = that.getItemProp(that.active),
                //获得卡左侧位置
                activeTabLeftPos = activeTabProp.where - activeTab.tabLis.outerWidth(true) + movePos,
                //获得卡右侧位置
                activeTabRightPos = activeTabProp.where + movePos,
                //获得卡包围层的宽度
                getWrapWidth = that.tabItemWrap.width();
            //已显示滚动条
            if (that.scrolled) {
                //如果左侧在范围外
                if (activeTabLeftPos < 0) {
                    //如果最后一个卡的右侧位置+移动后的位置还未到达最右端
                    if (that.tabsArr[that.tabsArr.length - 1].where + movePos + Math.abs(activeTabLeftPos) < getWrapWidth) {
                        that.shiftPosition(1, getWrapWidth - (that.tabsArr[tabsArr.length - 1].where + movePos));
                    } else {
                        //移动到可见位置
                        that.shiftPosition(1, Math.abs(activeTabLeftPos));
                    }
                } else if (activeTabRightPos > getWrapWidth) {
                    //如果右侧在范围外
                    that.shiftPosition(0, activeTabRightPos - getWrapWidth);
                } else if (that.tabsArr[that.tabsArr.length - 1].where + movePos < getWrapWidth) {
                    //左右都在范围内，但最后一个卡右侧未达到最右端
                    that.shiftPosition(1, getWrapWidth - (that.tabsArr[that.tabsArr.length - 1].where + movePos));
                }
            } else {
                //如果左侧在范围外
                if (movePos < 0) {
                    //移动到最左端
                    that.shiftPosition(1, Math.abs(movePos));
                }
            }
        },
        /**
         * 获得ItemID
         * @param {string | number} tabId
         */
        getItemTab: function(tabId) {
            if (typeof tabId === "number") {
                tabId = this.getItemObj(tabId).tab;
            }
            return tabId;
        },
        /**
         * 获得Item的属性
         * @param {string} tabId
         */
        getItemProp: function(tabId) {
            for (var i = 0; i < this.tabsArr.length; i++) {
                if (this.tabsArr[i].tab === tabId) {
                    return this.tabsArr[i];
                }
            }
        },
        /**
         * 获得Item对象
         * @param {number} index
         */
        getItemObj: function(index) {
            return this.tabItem[this.tabsArr[index].tab];
        },
        /**
         * 重置各属性值
         */
        resize: function() {
            this.setTabPos();
            this.showScroll();
            this.shiftVisible();
        }
    };
    return jeTabPane;
});

/**
 * Created by sinarts on 17/2/22.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeTable = factory(window.$ || $);
    }
})(this, function($) {
    var regPxe = /\px|pt|em|rem/g,
        je = {},
        jeTable = function(elem, opts) {
            var config = {
                skin: "je-grid", //默认风格
                width: "100%", //表格标签宽度
                height: "auto", //表格标签宽度
                columnSort: [], //头部可排序的数，如[1,3,5],其中1表示第一个可排序
                columns: [], //数据模型
                pageField: { //分页对象或函数
                    pageIndex: { field: "size", num: 1 }, //默认为第一页
                    pageSize: { field: "pagesize", num: 12 }, //默认每页显示12条
                    dataCount: "", //数据记录统计字段
                    pageCount: "", //页码统计字段
                    ellipsis: false //是否显示两边省略号
                },
                datas: { url: "", type: "GET", data: {}, dataType: "json", field: "" }, //AJAX请求的参数。可以是普通对象或函数。 函数返回一个参数对象
                isPage: true, //是否显示分页
                itemfun: function(elem, data) {}, //当前的回调，elem为表格当前行的ID, data为表格当前行的数据
                success: null //加载成功后的回调
            };
            this.opts = $.extend(true, config, opts || {});
            this.elCell = elem;
            this.init();
        };

    je.isBool = function(obj) { return (obj == undefined || obj == true ? true : false); };

    $.fn.jeTable = function(options) {
        return this.each(function() {
            return new jeTable($(this), options || {});
        });
    };
    $.extend({
        jeTable: function(elem, options) {
            return $(elem).each(function() {
                return new jeTable($(this), options || {});
            });
        }
    });
    var jefn = jeTable.prototype;
    jefn.init = function() {
        var that = this,
            opts = that.opts,
            pageIdxSize = {},
            pgField = opts.pageField;
        var wrapDiv = $('<div class="' + opts.skin + '"></div>'),
            theadDiv = $('<div class="' + opts.skin + '-thead"></div>'),
            tbodyDiv = $('<div class="' + opts.skin + '-tbody"></div>'),
            fieldDiv = $('<div class="' + opts.skin + '-field"></div>'),
            maskDiv = $('<div class="' + opts.skin + '-mask"></div>');
        that.elCell.html(wrapDiv.append(theadDiv.append("<table jetableth><thead><tr></tr></thead></table>")).append(tbodyDiv.append(maskDiv).append("<table jetabletd><tbody></tbody></table>")));
        wrapDiv.css({ width: (opts.width == "100%" ? "auto" : opts.width), position: "relative", "overflow": "hidden" });
        tbodyDiv.after(fieldDiv.append("<h3><span>字段列表</span><em></em></h3><ul></ul>"));
        theadDiv.after("<div class='fielddrop'></div>");
        that.setContent();
        that.showField(fieldDiv);
        pageIdxSize[pgField.pageIndex.field] = pgField.pageIndex.num;
        pageIdxSize[pgField.pageSize.field] = pgField.pageSize.num;
        that.loadDates(wrapDiv, pageIdxSize);
    };

    jefn.loadDates = function(elem, datas) {
        var that = this,
            opts = that.opts,
            colDate = opts.columns,
            dataObj = opts.datas,
            pgField = opts.pageField,
            dataArr = $.extend(dataObj.data, datas),
            tbody = that.elCell.find("table[jetabletd]"),
            maskCls = that.elCell.find('.' + opts.skin + '-mask');
        //载入内容前先清空
        tbody.find('tbody').empty();
        maskCls.show().html("<div class='loading'>正在载入数据...</div>");
        //把数据插入到tbody内
        var tbodySuccess = function(data, json) {
            json = json || "";
            tbody.find('tbody').empty();
            //循环数据插入内容
            $.each(data, function(idx, val) {
                var tr = $("<tr row='" + idx + "'></tr>");
                $.each(colDate, function(i, d) {
                    var isShow = je.isBool(d.isShow),
                        alVal = d.align || "left";
                    var renVal = (d.renderer != "" && d.renderer != undefined) ? d.renderer(val, idx) : val[d.field],
                        tdCls = $("<td class='field-" + d.field + "'><div>" + renVal + "</div></td>").addClass("dfields").attr("align", alVal).css({ width: d.width });
                    tr.append(isShow ? tdCls : tdCls.hide());
                });
                tbody.find('tbody').append(tr);
                //加载成功后的回调
                if ($.isFunction(opts.itemfun) || opts.itemfun != ("" || null)) {
                    opts.itemfun && opts.itemfun(tr, val);
                }
            });
            //表格分页设置，判断分页DIV是否已经存在，如果不存在就创建
            if (opts.isPage && that.elCell.find("." + opts.skin + "-page").length == 0) {
                //创建分页DIV
                var pageDiv = $('<div class="' + opts.skin + '-page"></div>');
                elem.append(pageDiv);
                //执行分页插件
                pageDiv.jeTablePage({
                    dataCount: json[pgField.dataCount],
                    pageCount: json[pgField.pageCount],
                    ellipsis: pgField.ellipsis,
                    jumpChange: function(page) {
                        //获取分页页码的key值与当前分页数组成对象
                        var obj = {};
                        obj[pgField.pageIndex.field] = page;
                        //点击后刷新内容加载
                        that.loadDates(elem, $.extend(true, dataArr, obj));
                    }
                });
            }
            //下拉按钮与字段列表的显示隐藏
            var eltheadCls = that.elCell.find("." + opts.skin + "-thead"),
                fielddrop = that.elCell.find(".fielddrop");
            eltheadCls.on("mouseenter", function() {
                if (fielddrop.is(":hidden")) fielddrop.slideDown('fast');
            });
            $("." + opts.skin).on('mouseleave', function() {
                fielddrop.slideUp('fast');
            });
            that.elCell.find("." + opts.skin + "-tbody").on("mouseenter", function() {
                if (fielddrop.is(":visible")) fielddrop.slideUp('fast');
            });
            //点击显示字段列表
            fielddrop.on("click", function() {
                var elfieldCls = that.elCell.find("." + opts.skin + "-field");
                elfieldCls.css({ top: eltheadCls.outerHeight(true), bottom: that.elCell.find("." + opts.skin + "-page").outerHeight(true) })
                fielddrop.hide();
                elfieldCls.slideDown('fast');
                //点击隐藏字段列表
                elfieldCls.find("h3 em").on("click", function() {
                    elfieldCls.slideUp('fast');
                })
            });
            //加载成功后的回调
            if ($.isFunction(opts.success) || opts.success != "" || opts.success != null) {
                opts.success && opts.success(that.elCell, tbody);
            }
        };
        //拉取数据
        if ($.isArray(dataObj)) {
            tbodySuccess(dataObj, "");
            maskCls.hide();
        } else {
            $.ajax({
                url: dataObj.url,
                type: dataObj.type,
                data: dataArr || {},
                dataType: dataObj.dataType || "json",
                async: dataObj.async || true,
                success: function(json) {
                    var rowVal = dataObj.field == "" ? json : json[dataObj.field];
                    if (rowVal.length == 0 || rowVal == undefined) {
                        maskCls.show().html("<div class='nocontent'>抱歉无更多内容了</div>");
                    } else {
                        tbodySuccess(rowVal, json);
                        maskCls.hide();
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    maskCls.show().html("<div class='error'>抱歉请求失败了</div>")
                }
            });
        };
    };
    //表格基本框架与宽度设置
    jefn.setContent = function() {
        var that = this,
            opts = that.opts,
            colDate = opts.columns,
            thead = that.elCell.find("table[jetableth]"),
            tbody = that.elCell.find("table[jetabletd]");
        var tableSum = 0;
        //设置头部
        $.each(colDate, function(i, d) {
            var isShow = je.isBool(d.isShow),
                nameval, dname = d.name;
            nameval = $.isArray(dname) ? ($.isFunction(dname[1]) ? dname[1](dname) : dname[1]) : dname;
            var althVal = d.align || "left",
                thCls = $("<th class='field-" + d.field + "'><div>" + nameval + "</div></th>").addClass("dfields").attr("align", althVal).css({ width: d.width });
            var col = $("<col class='cols-" + d.field + "' cols='true'>").css({ width: d.width });
            //为table设置隐藏域的宽度
            $("table[jetableth]", that.elCell).append(isShow ? col : "");
            thead.find("thead tr").append(isShow ? thCls : thCls.hide());
            tableSum += parseInt(isShow ? d.width.replace(regPxe, "") : 0);
        });

        //计算表格的宽度及高度
        var tbodyHeight = opts.height == "auto" ? "" : opts.height;
        tbody.parent().css({ height: tbodyHeight });
        that.elCell.find("table").css({ width: tableSum });
        //让浮动的头部跟着内容滚动
        tbody.parent().on("scroll", function() {
            var scVal = parseInt("-" + tbody.parent().scrollLeft());
            thead.css({ left: scVal });
        });
        //进行表格排序
        if (opts.columnSort.length > 0) {
            that.tableSorter({ elhead: thead, elbody: tbody, colSort: opts.columnSort });
        }
    };
    //表格排序
    jefn.tableSorter = function(obj) {
        var colSort = obj.colSort,
            eltop = obj.elhead,
            thCls = eltop.find("thead th"),
            all = "all",
            sa = "asc",
            sd = "desc",
            elcon = (obj.elbody == "" || obj.elbody == undefined) ? eltop : obj.elbody;
        $.each(colSort, function(i, d) {
            thCls.eq(d - 1).addClass("colsort all").attr("sort", sa).append("<em></em>");
        });
        //取出TD的值，并存入数组,取出前二个TD值；
        var setSort = function(idx, sorted) {
            var sortedMap = [];
            elcon.find("tbody tr").each(function() {
                var ts = $(this),
                    tdVal = ts.children("td").eq(idx).text();
                sortedMap.push({ row: ts, vals: tdVal });
            });
            //对数据进行排序
            sortedMap.sort(function(ra, rb) {
                var a = ra.vals,
                    b = rb.vals,
                    dateSort = function(d1, d2) {
                        if (!isNaN(d1) && !isNaN(d2)) {
                            return parseInt(d1) - parseInt(d2);
                        }
                        return d1.localeCompare(d2);
                    };
                return sorted == sa ? dateSort(a, b) : dateSort(b, a);
            });
            $.each(sortedMap, function(key, val) {
                elcon.find("tbody").append(val.row);
            });
        };
        //点击表格升序/降序
        thCls.on("click", function() {
            var _this = $(this),
                idx = _this.index();
            if (_this.hasClass("colsort")) {
                eltop.find("thead th.colsort").addClass(all);
                thCls.removeClass(sd).removeClass(sa);
                var deasc = _this.attr("sort") == sa ? sd : sa;
                if (_this.attr("sort") == sa) {
                    _this.attr("sort", sd);
                    _this.removeClass(all).addClass(sd);
                } else {
                    _this.attr("sort", sa);
                    _this.removeClass(all).addClass(sa);
                }
                setSort(idx, deasc);
            }
        })
    };

    //是否显示字段内容
    jefn.showField = function(fieldCls) {
        var that = this,
            opts = that.opts,
            colDate = opts.columns,
            thead = that.elCell.find("table[jetableth]"),
            tbody = that.elCell.find("table[jetabletd]");
        //把相应的字段显示
        $.each(colDate, function(i, d) {
            var isShow = je.isBool(d.isShow),
                sname = d.name,
                nameval = $.isArray(sname) ? sname[0] : sname;
            var fp = $("<li class='jetablego-" + d.field + "'><label><input name='field' field='" + d.field + "' " + (isShow ? "checked" : "") + " type='checkbox' value='' /> " + nameval + "</label></li>");
            fieldCls.find("ul").append(fp);
        });
        //点击后对相应的字段内容进行隐藏显示
        fieldCls.find("li label").on("click", function() {
            var inputs = $(this).find("input"),
                isCheck = inputs.prop('checked'),
                fields = inputs.attr("field");
            //判断字段复选框是否选中
            if (isCheck) {
                that.elCell.find(".cols-" + fields).attr("cols", "true");
                that.elCell.find(".field-" + fields).addClass("dfields").show();
            } else {
                that.elCell.find(".cols-" + fields).attr("cols", "false");
                that.elCell.find(".field-" + fields).removeClass("dfields").hide();
            };
            //获取非隐藏字段的宽度
            var colW = 0;
            thead.each(function() {
                colW += parseInt($(this).find("col[cols=true]").css("width").replace(regPxe, ""));
            });
            that.elCell.find("table").css({ width: colW });
        })
    };
    return jeTable;
});

;
(function($) {
    var isEven = function(num) { // true偶数, false奇数
            return (parseInt(num) % 2 == 0) ? true : false;
        },
        jePage = function(elem, options) {
            var defaults = {
                pageIndex: 1, //当前页码，1表示第一页
                pageSize: 5, //每页显示数量
                pageCount: 50, //显示项的总数量
                dataCount: 0,
                ellipsis: true, //是否显示两边省略号
                firstText: '首页', //
                lastText: '尾页',
                prevText: "上一页", //上一页按钮显示的文字
                nextText: "下一页", //下一页按钮显示的文字
                hashUrl: null, //构造页码按钮链接href的方法,包含一个pageIndex参数，不传则返回"javascript:;"
                jumpChange: null //点击页码后的回调函数，包含一个pageIndex参数
            };
            this.elCell = elem;
            this.opts = $.extend(defaults, options || {});
            this.init();
        };
    $.fn.jeTablePage = function(options) {
        return this.each(function() {
            return new jePage($(this), options || {});
        });
    };
    var jepg = jePage.prototype;
    jepg.init = function() {
        var that = this,
            opts = that.opts;
        this.createHtml(opts.pageIndex);
        that.bindEvent();
    };
    jepg.createHtml = function(pagenum) {
        pagenum = parseInt(pagenum);
        if (isEven(this.opts.pageSize)) { alert("请将pageSize设为奇数，且不能小于3"); return }
        var that = this,
            opts = that.opts,
            html = [],
            start = opts.pageIndex,
            group = opts.pageSize,
            pageCount = Math.ceil(opts.pageCount),
            dataCount = parseInt(opts.dataCount),
            onBoth = Math.floor(opts.pageSize / 2);
        if (pagenum >= group) {
            start = pagenum - onBoth;
            group = pagenum + onBoth;
        }
        if (group > pageCount) {
            start = pageCount - onBoth * 2;
            group = pageCount;
        }
        if (start < 1) start = 1;
        //统计页码的条数
        html.push('<span class="pagecount">共<em>' + pageCount + '</em>页</span>');
        //统计数据的条数
        if (dataCount > 0 || dataCount != "") {
            html.push('<span class="datacount">共<em>' + dataCount + '</em>条记录</span>');
        }
        //生成上一页的按钮
        if (pagenum > 1) {
            html.push('<a data-page="' + (pagenum - 1) + '" href="' + that.hashUrl(pagenum - 1) + '" class="flip" title="上一页">' + opts.prevText + '</a>');
        } else {
            html.push('<span class="flip noPage" title="上一页">' + opts.prevText + '</span>');
        }
        // 第一页
        if (pagenum > opts.pageSize - 1) {
            var firstText = opts.ellipsis ? (opts.firstText == "" ? 1 : opts.firstText) : opts.firstText;
            html.push("<a href='" + that.hashUrl(1) + "' data-page='" + 1 + "' class='flip' title='" + firstText + "'>" + firstText + "</a> ");
            if (opts.ellipsis) html.push("<span>···</span>");
        }
        // 循环渲染可见的按钮
        for (var i = start; i <= group; i++) {
            if (i == pagenum) {
                html.push('<span class="current">' + i + '</span>');
            } else {
                html.push('<a href="' + that.hashUrl(i) + '" data-page="' + i + '" title="' + i + '">' + i + '</a>');
            }
        }
        // 最后一页
        if (pagenum < pageCount - (onBoth + 1)) {
            var lastText = opts.ellipsis ? (opts.lastText == "" ? pageCount : opts.lastText) : opts.lastText;
            if (opts.ellipsis) html.push("<span>···</span> ");
            html.push("<a href='" + this.hashUrl(pageCount) + "' data-page='" + pageCount + "' class='flip' title='" + lastText + "'>" + lastText + "</a> ");
        }
        //生成下一页的按钮
        if (pagenum < pageCount) {
            html.push('<a data-page="' + (pagenum + 1) + '" href="' + that.hashUrl(pagenum + 1) + '" class="flip" title="下一页">' + opts.nextText + '</a>');
        } else {
            html.push('<span class="flip noPage">' + opts.nextText + '</span>');
        }
        //跳转设置页码
        html.push('<span>转到<input type="text" class="gopage"><button type="button" class="gobtn">Go</button></span>');
        that.elCell.html("<div class='pagebox'>" + html.join("") + "</div>");
    };
    jepg.bindEvent = function() {
        var that = this,
            opts = that.opts;
        that.elCell.on("click", "a", function() {
            var pageIndex = parseInt($(this).data("page"), 10);
            that.createHtml(pageIndex);
            opts.jumpChange && opts.jumpChange(pageIndex);
        });
        that.elCell.on("click", ".gobtn", function() {
            var indexVal = that.elCell.find(".gopage").val();
            if (indexVal != "") {
                that.setPageIndex(indexVal);
            }
        });
    };
    jepg.hashUrl = function(pageIndex) {
        var that = this,
            opts = that.opts;
        if ($.isFunction(opts.hashUrl)) {
            return opts.hashUrl(pageIndex);
        }
        return "javascript:;";
    };
    jepg.setPageIndex = function(pageIndex) {
        this.createHtml(pageIndex);
        this.opts.jumpChange && this.opts.jumpChange(pageIndex);
    };
    var jeTablePage = function(y, m, d) {
        return new jePage(new Date(y, m, d));
    };
    return jeTablePage;
})(jQuery);

/**
 * Created by sinarts on 17/1/13.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeSelect = factory(window.$ || $);
    }
})(this, function($) {
    $.fn.jeSelect = function(options) {
        return this.each(function() {
            return new jeSelect($(this), options || {});
        });
    };
    $.extend({
        jeSelect: function(elem, options) {
            return $(elem).each(function() {
                return new jeSelect($(this), options || {});
            });
        }
    });
    var config = {
            dropBox: "je-select", //目标框class名
            openCls: "je-select-open", //下拉展开class名
            currCls: "on", //下拉选中高亮class名
            size: 8, //设置高度(个数)
            sosList: true, //是否开启模糊搜索
            zIndex: 2099, //下拉弹层的层级高度
            itemfun: function(elem, index, val) {}, //点击当前的回调，elem：当前Select的ID index：索引 val：选中的值
            success: null //加载成功后的回调
        },
        jeSelect = function(elem, opts) {
            this.opts = $.extend(config, opts || {});
            this.elCell = elem;
            this.init();
        };
    var jefn = jeSelect.prototype;
    //初始化并创建元素
    jefn.init = function() {
        var _this = this,
            opts = _this.opts,
            inelem = _this.elCell;
        var jeuuid = function() {
            var str = "",
                arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
            for (var i = 0; i < 10; i++) str += arr[Math.round(Math.random() * (arr.length - 1))];
            return str;
        }();
        inelem.hide();
        var dropBox = $("<div id='jeselbox" + jeuuid + "'></div>").addClass(opts.dropBox);
        inelem.after(dropBox.text(inelem.find("option:selected").text()));
        //判断是否已经禁用
        if (inelem.is(":disabled")) {
            dropBox.addClass("disabled");
            return;
        }
        //执行元素绑定
        _this.onBind(jeuuid);
        //加载成功后的回调
        if ($.isFunction(opts.success) || opts.success != ("" || null)) {
            opts.success && opts.success(inelem);
        }
    };
    //点击事件绑定
    jefn.onBind = function(uuid) {
        var _this = this,
            opts = _this.opts,
            inelem = _this.elCell;
        $("#jeselbox" + uuid).on("click", function() {
            var openCell = _this.setCentent(uuid),
                bthis = $(this);
            //模拟列表点击事件-赋值
            openCell.find("dd").on("click", function() {
                var othis = $(this),
                    index = parseInt(othis.attr("item"));
                othis.addClass(opts.currCls).siblings().removeClass(opts.currCls);
                //同时改变select的选中状态
                inelem.trigger("change");
                inelem.find("option").removeAttr("selected").eq(index).attr("selected", true);
                openCell.remove();
                var vals = othis.attr("val"),
                    txts = inelem.find("option:selected").text();
                $("#jeselbox" + uuid).text(txts);
                //点击选中后的回调
                if (opts.itemfun != undefined && typeof opts.itemfun === "function") {
                    opts.itemfun(inelem, index, vals, txts);
                }
            });
            //执行方向定位
            _this.selectOrien(openCell, bthis);
            $(window).resize(function() {
                    _this.selectOrien(openCell, bthis);
                })
                //点击空白处隐藏
            $(document).on("mouseup scroll", function(ev) {
                ev.stopPropagation();
                if (openCell && openCell.css("display") !== "none") openCell.remove();
            });
            openCell.on("mouseup", function(ev) {
                ev.stopPropagation();
            });
        });
    };
    //获取option的内容并设置
    jefn.setCentent = function(uuid) {
        var _this = this,
            opts = _this.opts,
            selHtml = "",
            s = 0,
            selbox = $("#jeselbox" + uuid);
        //创建并生成下拉列表
        var openDiv = $("<div id='jeselopens'></div>").addClass(opts.openCls);
        $("body").append(openDiv.css({ width: selbox.innerWidth(), "z-index": opts.zIndex }).append("<div class='opensoso'><input type='text'/></div><dl></dl>"));
        $("option, optgroup", _this.elCell).each(function() {
            //判断是否为option
            if ($(this).is("option")) {
                var groupCell = $(this).parent().is("optgroup") ? "group" : "",
                    text = $(this).text();
                //判断初始化是否为选中状态
                if ($(this).is(":selected")) {
                    selHtml += '<dd title="' + text + '" item="' + (s++) + '" class="' + opts.currCls + ' ' + groupCell + '">' + text + "</dd>";
                } else {
                    selHtml += '<dd title="' + text + '" item="' + (s++) + '" val="' + $(this).attr("value") + '" class="' + groupCell + '">' + text + "</dd>";
                }
            } else {
                //模拟分组html
                selHtml += '<dt title="' + $(this).attr("label") + '" val="' + $(this).attr("label") + '">' + $(this).attr("label") + "</dt>";
            }
        });
        openDiv.find("dl").html("").append(selHtml);
        var childCell = openDiv.find("dl").children();
        //如果显示的条数超过预设的条数进行高度设置
        if (opts.size < childCell.length) {
            openDiv.find("dl").css({
                height: childCell.height() * opts.size
            });
        }
        _this.searchList(openDiv, uuid);
        return openDiv;
    };
    //对列表进行模糊搜索
    jefn.searchList = function(openCell, uuid) {
        var _this = this,
            opts = _this.opts,
            selbox = $("#jeselbox" + uuid);
        if (opts.sosList) {
            openCell.find("input").on("input cut focus keydown keyup paste", function() {
                var sothat = $(this),
                    soVal = sothat.val(),
                    opendlCell = openCell.find("dl");
                //判断不为空的条件下
                if (soVal != "") {
                    opendlCell.children().each(function(i) {
                        var conText = $(this).text();
                        //如果输入的值与找到的值不匹配
                        if ((conText.indexOf(soVal.toLowerCase()) < 0) && (conText.indexOf(soVal.toUpperCase()) < 0)) {
                            $(this).css("display", "none");
                        } else {
                            $(this).css("display", "block");
                            if ($(this).is(":visible") && $(this).length < opts.size) {
                                opendlCell.css("height", "");
                            }
                        }
                        _this.selectOrien(openCell, selbox);
                    });
                } else {
                    opendlCell.children().each(function(i) {
                        $(this).css("display", "");
                    });
                    if (opts.size < opendlCell.children().length) {
                        setTimeout(function() {
                            opendlCell.css({
                                height: opendlCell.children().height() * opts.size
                            });
                            _this.selectOrien(openCell, selbox);
                        }, 5)
                    }
                }
            })
        } else {
            openCell.find(".opensoso").hide();
        }
    };
    //方位辨别定位
    jefn.selectOrien = function(obj, self, pos) {
        var tops, leris, ortop, orleri, rect = self[0].getBoundingClientRect();
        var docScroll = function(type) {
            type = type ? "scrollLeft" : "scrollTop";
            return document.body[type] | document.documentElement[type];
        };
        var winarea = function(type) {
            return document.documentElement[type ? "clientWidth" : "clientHeight"];
        };
        //计算目标元素的坐标
        leris = rect.right + obj.outerWidth() / 1.5 >= winarea(1) ? rect.right - obj.outerWidth() : rect.left + (pos ? 0 : docScroll(1));
        tops = rect.bottom + obj.outerHeight() / 1 <= winarea() ? rect.bottom : rect.top > obj.outerHeight() / 1.5 ? rect.top - obj.outerHeight() - 2 : winarea() - obj.outerHeight();
        ortop = Math.max(tops + (pos ? 0 : docScroll()) + 1, 1) + "px", orleri = leris + "px";
        obj.css({
            top: ortop,
            left: orleri
        });
    };
    return jeSelect;
});

/**
 * Created by sin on 2017/4/16.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeProgress = factory(window.$ || $);
    }
})(this, function($) {
    $.fn.jeProgress = function(options) {
        return this.each(function() {
            return new jeProgress($(this), options || {});
        });
    };
    $.extend({
        jeProgress: function(elem, options) {
            return $(elem).each(function() {
                return new jeProgress($(this), options || {});
            });
        }
    });
    var jeProgress = function(elem, opts) {
        var config = {
            skin: "je-progress",
            success: null //加载成功后的回调
        };
        this.opts = $.extend(config, opts || {});
        this.elCell = elem;
        this.init();
    };
    var jefn = jeProgress.prototype;
    jefn.init = function() {
        var that = this,
            opts = that.opts;
        //加载数据
        that.elCell.each(function() {
            var othis = $(this),
                elemBar = othis.find('.' + opts.skin + '-bar'),
                percwidth = elemBar.attr('percent');
            elemBar.css('width', percwidth);
            if (othis.attr('showtext') == "true") {
                setTimeout(function() {
                    var percent = Math.round(elemBar.width() / othis.width() * 100);
                    if (percent > 100) percent = 100;
                    elemBar.html('<span class="' + opts.skin + '-text">' + percent + '%</span>');
                }, 450);
            }
        });

        //加载成功后的回调
        if ($.isFunction(opts.success) || opts.success != ("" || null)) {
            opts.success && opts.success();
        }
    };
    return jeProgress;
});

/**
 * Created by SinArts on 2017/1/14.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "optsect") {
        //umd
        module.exports = factory();
    } else {
        root.jeNavTab = factory(window.$ || $);
    }
})(this, function($) {
    $.fn.jeNavTab = function(options) {
        return this.each(function() {
            return new jeNavTab($(this), options || {});
        });
    };
    $.extend({
        jeNavTab: function(elem, options) {
            return $(elem).each(function() {
                return new jeNavTab($(this), options || {});
            });
        }
    });
    var config = {
            titCls: ".hd ul",
            /*按钮的父级Class*/
            mainCls: ".bd",
            /*内容的父级Class*/
            titliCls: "li",
            listCls: ".list",
            currCls: "on",
            /*当前导航选中位置自动增加的class名称*/
            trigger: "mouseover",
            /*事件参数 click,mouseover*/
            animation: "no",
            /*动画方向 left,top,fadein,no 为无动画*/
            animspeed: 300,
            /*动画运动速度*/
            delay: 0,
            /*Tab延迟速度*/
            tabIndex: 1,
            /*默认的当前位置索引。1是第一个；tabIndex:1 时，相当于从第2个开始执行*/
            autoPage: false,
            /*是否自动分页，自定义如：autoPage:"<a>$</a>"*/
            autoPlay: true,
            /*是否开启自动运行 true,false,  */
            autoSpeed: 3e3,
            /*自动运行速度*/
            pageState: ".pageState",
            /*用于显示分页状态,如：2/3 */
            vis: 1,
            /*当内容个数少于可视个数，不执行效果*/
            scroll: 1,
            prevCell: ".prev",
            /*前一个/页按钮对象*/
            nextCell: ".next"
        },
        jeNavTab = function(elem, opts) {
            this.opts = $.extend(config, opts || {});
            this.elCell = elem;
            this.init();
        };
    var jefn = jeNavTab.prototype;
    jefn.init = function() {
        var that = this,
            opts = that.opts,
            elCell = that.elCell;
        that.trigger = opts.trigger;
        that.titCell = $(opts.titCls, elCell);
        that.mainCell = $(opts.mainCls, elCell);
        that.titliCell = $(opts.titliCls, that.titCell);
        that.artlist = $(opts.listCls, that.mainCell);
        that.anim = opts.animation;
        that.curr = opts.currCls;
        that.Paging = $(opts.pageState, elCell);
        that.prev = $(opts.prevCell, elCell);
        that.next = $(opts.nextCell, elCell);
        that.Index = elCell.index(1) + opts.tabIndex;
        that.len = that.artlist.size();
        var coW = that.artlist.outerWidth(true),
            coH = that.artlist.outerHeight(true),
            lisW = that.artlist.width(),
            lisH = that.artlist.height(),
            lenW = that.len * coW,
            lenH = that.len * coH,
            vis = parseInt(opts.vis);
        if (opts.autoPage) {
            var autoNumStr = "";
            if (that.len >= vis) {
                //当内容个数少于可视个数，不执行效果
                if (opts.autoPage == true || opts.autoPage == "true") {
                    for (var Num = 0; Num < that.len; Num++) {
                        autoNumStr += "<li>" + (Num + 1) + "</li>";
                    }
                } else {
                    for (var Num = 0; Num < that.len; Num++) {
                        autoNumStr += opts.autoPage.replace("$", Num + 1);
                    }
                }
            }
            that.titCell.html(autoNumStr);
            that.titliCell = $(opts.titliCls, that.titCell);
        }
        //判断动画方向
        if (that.anim == "left") {
            that.mainCell.wrap('<div class="tempWrap" style="overflow:hidden; position:relative;width:' + coW + 'px"></div>');
        } else if (that.anim == "top") {
            that.mainCell.wrap('<div class="tempWrap" style="overflow:hidden; position:relative;height:' + coH + 'px"></div>');
        }
        if (that.len >= vis) {
            //当内容个数少于可视个数，不执行效果
            that.fnMove = function() {
                var Miw = that.Index * coW,
                    Mih = that.Index * coH;
                that.titliCell.eq(that.Index).addClass(that.curr).siblings(that.titliCell).removeClass(that.curr);
                switch (that.anim) {
                    case "no":
                        that.artlist.eq(that.Index).show().siblings(that.artlist).hide();
                        break;

                    case "left":
                        that.mainCell.css({
                            position: "relative",
                            overflow: "hidden",
                            padding: 0,
                            margin: 0,
                            width: lenW
                        });
                        that.artlist.css({
                            "float": "left",
                            width: lisW,
                            display: "block"
                        }).end().stop().animate({
                            left: -Miw
                        }, opts.animspeed);
                        break;

                    case "top":
                        that.mainCell.css({
                            position: "relative",
                            overflow: "hidden",
                            padding: 0,
                            margin: 0,
                            height: lenH
                        });
                        that.artlist.css({
                            "float": "left",
                            height: lisH,
                            display: "block"
                        }).end().stop().animate({
                            top: -Mih
                        }, opts.animspeed);
                        break;

                    case "fadein":
                        that.artlist.eq(that.Index).fadeIn(500).siblings(that.artlist).hide();
                        break;
                }
                //用于显示分页状态
                that.Paging.html("<span class='pagstate'>" + (that.Index + 1) + "</span>/" + that.titliCell.size());
            };
            that.fnMove();
        }
        that.onBind();
    };
    jefn.onBind = function() {
        var that = this,
            opts = that.opts,
            timer;
        //判断事件类型
        if (that.trigger == "mouseover") {
            that.titliCell.hover(function() {
                var j = that.titliCell.index($(this));

                function seve() {
                    that.Index = j;
                    that.fnMove();
                }
                timer = setTimeout(seve, opts.delay);
            }, function() {
                clearTimeout(timer);
            });
        } else {
            that.titliCell.on(that.trigger, function() {
                that.Index = that.titliCell.index($(this));
                that.fnMove();
            });
        }
        // Slide：减（左）按钮
        that.prev.click(function() {
            if (that.mainCell.is(":not(:animated)")) {
                var dur = 1;
                if (that.Index > 0) {
                    that.Index--;
                } else {
                    that.Index = that.len - 1;
                    dur = that.Index;
                }
                that.fnMove();
            }
        });
        // Slide：增（右）按钮
        that.next.click(function() {
            if (that.mainCell.is(":not(:animated)")) {
                var dur = 1;
                if (that.Index < that.len - 1) {
                    Ithat.ndex++;
                } else {
                    that.Index = 0;
                    dur = that.len - 1;
                }
                fnMove();
            }
        });
        //Slide自动运行	
        var startRun = function() {
            timer = setInterval(function() {
                that.Index++;
                if (that.Index > that.len - 1) that.Index = 0;
                that.fnMove();
            }, opts.autoSpeed);
        };
        //Slide结束运行	
        var stopRun = function() {
            clearInterval(timer);
        };
        //如果自动运行开启，调用自动运行函数
        if (opts.autoPlay) {
            that.elCell.hover(function() {
                stopRun();
            }, function() {
                startRun();
            });
            startRun();
        }
    };
    return jeNavTab;
});

/**
 * Created by SinArts on 2017/1/20.
 */
;
(function(root, factory) {
    //amd
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else if (typeof exports === 'object') { //umd
        module.exports = factory();
    } else {
        root.jeLayout = factory(window.jQuery || $);
    }
})(this, function($) {
    $.fn.jeLayout = function(options) {
        return this.each(function() {
            return new jeLayout($(this), options || {});
        });
    };
    $.extend({
        jeLayout: function(elem, options) {
            return $(elem).each(function() {
                return new jeLayout($(this), options || {});
            });
        }
    });
    var jeLayout = function(elem, opts) {
        var config = {
            leftWidth: "200px",
            rightWidth: 0,
            shrinkCell: ".shrink",
            success: null //加载成功后的回调函数
        };
        this.opts = $.extend(config, opts || {});
        this.elCell = elem;
        this.init();
    };
    var jefn = jeLayout.prototype;
    jefn.init = function() {
        var that = this,
            opts = that.opts;
        that.pane = [];
        that.elCell.css({ width: "auto", height: "auto", margin: 0, position: "absolute", top: 0, bottom: 0, left: 0, right: 0, zoom: 1, overflow: "hidden" });
        $.each(["top", "right", "left", "bottom", "center"], function(i, val) {
            var elem = that.elCell.children("[jepane=" + val + "]");
            that.pane.push(elem);
            if (elem.length > 0) {
                var pow = (val == "left" || val == "right") ? { position: "absolute", width: val == "right" ? opts.rightWidth || 0 : opts.leftWidth || 0 } : { position: "absolute" };
                elem.css(pow).css(val, 0);
            }
        });
        that.setSize();
        that.setShrink();
        $(window).resize(function() {
            that.setSize();
        });
        //加载成功后的回调
        if ($.isFunction(opts.success) || opts.success != ("" || null)) {
            opts.success && opts.success();
        }
    };
    jefn.setSize = function() {
        var that = this,
            opts = that.opts,
            winWidth = $(window).width(),
            winHeight = $(window).height(),
            topH = that.pane[0].outerHeight(true) || 0,
            bottomH = that.pane[3].outerHeight(true) || 0,
            rightW = that.pane[1].outerWidth(true) || 0,
            leftW = that.pane[2].outerWidth(true) || 0,
            leriHeight = winHeight - topH - bottomH;
        that.pane[1].css({ width: opts.rightWidth, height: leriHeight, top: topH, right: 0, bottom: bottomH });
        that.pane[2].css({ width: opts.leftWidth, height: leriHeight, top: topH, left: 0, bottom: bottomH });
        that.pane[4].attr('centwidth', winWidth - leftW - rightW).css({ width: winWidth - leftW - rightW, height: leriHeight, top: topH, left: leftW, right: rightW, bottom: bottomH });
    };
    jefn.setShrink = function() {
        var that = this,
            opts = that.opts;
        $(opts.shrinkCell).on("click", function() {
            var centw = parseInt(that.pane[4].attr('centwidth')),
                oplew = parseInt(opts.leftWidth.replace(/px|pt|rem/g, ""));
            if (that.pane[2].width() == oplew) {
                var centSize = centw + oplew;
                that.pane[2].css({ width: 0 });
                that.pane[4].css({ width: centSize, left: 0 }).attr('centwidth', centSize);
            } else {
                var centSize = centw - oplew;
                that.pane[2].css({ width: opts.leftWidth });
                that.pane[4].css({ width: centSize, left: opts.leftWidth }).attr('centwidth', centSize);
            }
        });
    };
    return jeLayout;
});

/**
 * Created by sinarts on 2017/5/22.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "optsect") {
        //umd
        module.exports = factory();
    } else {
        root.jeDropdown = factory(window.$ || $);
    }
})(this, function($) {
    $.fn.jeDropdown = function(options) {
        return this.each(function() {
            return new jeDropdown($(this), options || {});
        });
    };
    $.extend({
        jeDropdown: function(elem, options) {
            return $(elem).each(function() {
                return new jeDropdown($(this), options || {});
            });
        }
    });
    var searandom = function() {
            var str = "",
                arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
            for (var i = 0; i < 8; i++) str += arr[Math.round(Math.random() * (arr.length - 1))];
            return str;
        },
        docScroll = function(type) {
            type = type ? "scrollLeft" : "scrollTop";
            return document.body[type] | document.documentElement[type];
        },
        winarea = function(type) {
            return document.documentElement[type ? "clientWidth" : "clientHeight"];
        },
        jeDropdown = function(elem, opts) {
            var config = {
                skin: "je-drop",
                dataDrop: { url: "", type: "GET", data: {}, dataType: "json" },
                zIndex: 9999, //弹层层级关系
                align: "top", //提示层的箭头方向
                spacing: 2, //默认为距离对象的间隔
                success: null
            };
            this.opts = $.extend(config, opts || {});
            this.elCell = elem;
            this.init();
        };
    var jefn = jeDropdown.prototype;
    jefn.init = function() {
        var that = this,
            opts = that.opts,
            datas = "";
        if ($.isArray(opts.dataDrop)) {
            datas = opts.dataDrop;
        } else {
            $.ajax({
                url: opts.dataDrop.url,
                type: opts.dataDrop.type,
                data: opts.dataDrop.data || {},
                dataType: opts.dataDrop.dataType || "json",
                async: opts.dataDrop.async || true,
                success: function(json) {
                    datas = json
                }
            });
        }
        that.createDrop(datas);
    };
    //创建下拉的html片段
    jefn.createDrop = function(data) {
        var that = this,
            opts = that.opts;
        that.elCell.on("click", function() {
            var tid = that.elCell.attr("jedrop"),
                sdom = searandom(),
                dropDiv = $("<div/>", { "class": opts.skin, "id": "drop" + sdom }).css({ "z-index": opts.zIndex });
            //判断元素是否已经存在
            if ($("#drop" + tid).length == 0) {
                $("body").append(dropDiv.append("<ul></ul>"));
                $.each(data, function(i, val) {
                    var lis = $("<li/>", val.list || {}),
                        dropul = dropDiv.find("ul");
                    var urls = val.url != undefined && val.url != "" ? val.url : "javascript:;";
                    dropul.append(lis.append($("<a/>", { "href": urls }).text(val.name)));
                });
                that.elCell.attr("jedrop", sdom);
                if (opts.align == "auto") {
                    that.orien(dropDiv, that.elCell);
                } else {
                    that.posAlign(that.elCell, dropDiv);
                }
            }
        });
        //点击空白处隐藏
        $(document).on("mouseup", function(ev) {
            ev.stopPropagation();
            var box = $("." + opts.skin);
            if (box && box.css("display") !== "none") box.remove();
        });
        //加载成功后的回调
        if ($.isFunction(opts.success)) {
            opts.success && opts.success();
        }
    };
    //自动定位元素的位置
    jefn.orien = function(obj, self, pos) {
        var tops, leris, ortop, orleri, rect = self[0].getBoundingClientRect();
        //根据目标元素计算弹层位置
        leris = rect.right + obj.outerWidth() / 1.5 >= winarea(true) ? rect.right - obj.outerWidth() : rect.left + (pos ? 0 : docScroll(true));
        tops = rect.bottom + obj.outerHeight() / 1 <= winarea() ? rect.bottom - 1 : rect.top > obj.outerHeight() / 1.5 ? rect.top - obj.outerHeight() - 1 : winarea() - obj.outerHeight();
        ortop = Math.max(tops + (pos ? 0 : docScroll()) + 1, 1) + "px", orleri = leris + "px";
        obj.css({ "top": ortop, "left": orleri });
    };
    //根据参数进行元素定位
    jefn.posAlign = function(objcell, boxcell) {
        var that = this,
            opts = that.opts,
            spac = opts.spacing,
            postop, posleft;
        var post = parseInt(objcell.offset().top),
            posl = parseInt(objcell.offset().left),
            selfH = parseInt(objcell.outerHeight(true)),
            selfW = parseInt(objcell.outerWidth(true)),
            tipH = parseInt(boxcell.outerHeight(true)),
            tipW = parseInt(boxcell.outerWidth(true));
        switch (opts.align) {
            case 'top':
            case 'right':
                postop = post - tipH - spac;
                break;
            case 'left':
            case 'bottom':
                postop = post + selfH + spac;
                break;
        }
        posleft = (opts.align == 'top' || opts.align == 'left') ? posl : (posl + selfW - tipW);
        boxcell.css({ "top": postop, "left": posleft });
    };
    return jeDropdown;
});

/**
 @Name : jeDate v3.8.5 日期控件
 @Author: chen guojun
 @Date: 2017-06-18
 @QQ群：516754269
 @官网：http://www.jemui.com/ 或 https://github.com/singod/jeDate
 */

;
(function(root, factory) {
    //amd
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else if (typeof exports === 'object') { //umd
        module.exports = factory();
    } else {
        root.jeDate = factory(window.jQuery || $);
    }
})(this, function($) {
    var jet = {},
        doc = document,
        regymdzz = "YYYY|MM|DD|hh|mm|ss|zz",
        regymd = "YYYY|MM|DD|hh|mm|ss|zz".replace("|zz", ""),
        parseInt = function(n) { return window.parseInt(n, 10); },
        config = {
            skinCell: "jedateblue",
            language: {
                name: "cn",
                month: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
                weeks: ["日", "一", "二", "三", "四", "五", "六"],
                times: ["小时", "分钟", "秒数"],
                clear: "清空",
                today: "今天",
                yes: "确定",
                close: "关闭"
            },
            trigger: "click",
            format: "YYYY-MM-DD hh:mm:ss", //日期格式
            minDate: "1900-01-01 00:00:00", //最小日期
            maxDate: "2099-12-31 23:59:59" //最大日期
        };
    $.fn.jeDate = function(options) {
        return this.each(function() {
            return new jeDate($(this), options || {});
        });
    };
    $.extend({
        jeDate: function(elem, options) {
            return $(elem).each(function() {
                return new jeDate($(this), options || {});
            });
        }
    });
    jet.isObj = function(obj) {
        for (var i in obj) { return true; }
        return false;
    };
    jet.reMacth = function(str) {
        return str.match(/\w+|d+/g);
    };
    jet.docScroll = function(type) {
        type = type ? "scrollLeft" : "scrollTop";
        return doc.body[type] | doc.documentElement[type];
    };
    jet.winarea = function(type) {
        return doc.documentElement[type ? "clientWidth" : "clientHeight"];
    };
    //判断是否闰年
    jet.isLeap = function(y) {
        return (y % 100 !== 0 && y % 4 === 0) || (y % 400 === 0);
    };
    //获取本月的总天数
    jet.getDaysNum = function(y, m) {
        var num = 31;
        switch (parseInt(m)) {
            case 2:
                num = jet.isLeap(y) ? 29 : 28;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                num = 30;
                break;
        }
        return num;
    };
    //获取月与年
    jet.getYM = function(y, m, n) {
            var nd = new Date(y, m - 1);
            nd.setMonth(m - 1 + n);
            return {
                y: nd.getFullYear(),
                m: nd.getMonth() + 1
            };
        }
        //获取上个月
    jet.getPrevMonth = function(y, m, n) {
        return jet.getYM(y, m, 0 - (n || 1));
    };
    //获取下个月
    jet.getNextMonth = function(y, m, n) {
        return jet.getYM(y, m, n || 1);
    };
    //补齐数位
    jet.digit = function(num) {
        return num < 10 ? "0" + (num | 0) : num;
    };
    //判断是否为数字
    jet.IsNum = function(value) {
        return /^[+-]?\d*\.?\d*$/.test(value) ? true : false;
    };
    //转换日期格式
    jet.parse = function(ymd, hms, format) {
        ymd = ymd.concat(hms);
        var ymdObj = {},
            mat = regymdzz.split("|");
        $.each(ymd, function(i, val) {
            ymdObj[mat[i]] = parseInt(val);
        });
        return format.replace(new RegExp(regymdzz, "g"), function(str, index) {
            return str == "zz" ? "00" : jet.digit(ymdObj[str]);
        });
    };
    jet.checkFormat = function(format) {
        var ymdhms = [];
        format.replace(new RegExp(regymdzz, "g"), function(str, index) {
            ymdhms.push(str);
        });
        return ymdhms.join("-");
    };
    jet.parseMatch = function(str) {
        var timeArr = str.split(" ");
        return jet.reMacth(timeArr[0]);
    };
    jet.testFormat = function(format, conformat) {
        var mat = ["YYYY", "MM", "DD"],
            ymdhms = [],
            mats = [];
        format.replace(new RegExp(regymdzz, "g"), function(str, index) {
            ymdhms.push(str);
        });
        $.each(mat, function(m, d) {
            $.each(ymdhms, function(i, f) {
                if (d == f) mats.push(f);
            })
        });
        var reformat = format.substring(0, 2) == "hh" ? ymdhms.join("-") : mats.join("-");
        var remat = reformat == conformat ? true : false;
        return remat;
    };
    //验证日期
    jet.checkDate = function(date) {
        var dateArr = jet.reMacth(date);
        if (isNaN(dateArr[0]) || isNaN(dateArr[1]) || isNaN(dateArr[2])) return false;
        if (dateArr[1] > 12 || dateArr[1] < 1) return false;
        if (dateArr[2] < 1 || dateArr[2] > 31) return false;
        if ((dateArr[1] == 4 || dateArr[1] == 6 || dateArr[1] == 9 || dateArr[1] == 11) && dateArr[2] > 30) return false;
        if (dateArr[1] == 2) {
            if (dateArr[2] > 29) return false;
            if ((dateArr[0] % 100 == 0 && dateArr[0] % 400 != 0 || dateArr[0] % 4 != 0) && dateArr[2] > 28) return false;
        }
        return true;
    };
    //返回日期
    jet.returnDate = function(obj, format, dateval) {
        format = format || 'YYYY-MM-DD hh:mm:ss';
        var undate = (dateval == undefined || dateval == "" || dateval == []),
            darr = undate ? [] : jet.reMacth(dateval),
            sparr = [];
        if (!undate) {
            darr[1] -= 1;
            darr[1] = darr[1] == -1 ? 12 : darr[1];
        }
        var myDate = darr.length > 0 ? new Date(darr[0], darr[1], (darr[2] || 00), (darr[3] || 00), (darr[4] || 00), (darr[5] || 00)) : new Date(),
            myMM = myDate.getMonth(),
            myDD = myDate.getDate(),
            narr = [myDate.getFullYear(), myMM, myDD, myDate.getHours(), myDate.getMinutes(), myDate.getSeconds()];
        $.each(regymd.split("|"), function(i, val) {
            sparr.push(obj[val] || "");
        });
        var mday = jet.getDaysNum(narr[0], narr[1] + 1),
            isDay31 = mday == 31 && jet.digit(new Date().getDate()) == 31,
            parnaVal = narr[2] + parseInt(sparr[2] || 00),
            gday, reday;
        //判断今天是否为31号
        gday = isDay31 ? (parnaVal - 1) : parnaVal;
        //重新设置日期，必须要用new Date来设置，否则就会有问题
        var setdate = new Date(narr[0] + parseInt(sparr[0] || 00), narr[1] + parseInt(sparr[1] || 00), gday, narr[3] + parseInt(sparr[3] || 00), narr[4] + parseInt(sparr[4] || 00), narr[5] + parseInt(sparr[4] || 00));
        reday = isDay31 ? jet.digit(parseInt(setdate.getDate()) + 1) : jet.digit(setdate.getDate());
        //获取重新设置后的日期
        var reDate = jet.parse([setdate.getFullYear(), parseInt(setdate.getMonth()) + 1, reday], [jet.digit(setdate.getHours()), jet.digit(setdate.getMinutes()), jet.digit(setdate.getSeconds())], format);
        return reDate;
    };
    //判断元素类型
    jet.isValHtml = function(that) {
        return /textarea|input/.test(that[0].tagName.toLocaleLowerCase());
    };
    jet.isBool = function(obj) { return (obj == undefined || obj == true ? true : false); };
    jet.sortDate = function(time, format) {
        var timeObj = {},
            newtime = [],
            mats = regymd.split("|"),
            subhh = jet.checkFormat(format).substring(0, 2) == "hh" ? true : false,
            numArr = jet.IsNum(time) ? (jet.reMacth(subhh ? time.replace(/(.{2})/g, "$1,") : time.substr(0, 4).replace(/^(\d{4})/g, "$1,") + time.substr(4).replace(/(.{2})/g, "$1,"))) : jet.reMacth(time),
            matArr = jet.IsNum(time) ? (jet.reMacth(subhh ? format.replace(/(.{2})/g, "$1,") : format.substr(0, 4).replace(/^(\w{4})/g, "$1,") + format.substr(4).replace(/(.{2})/g, "$1,"))) : jet.reMacth(format);
        $.each(numArr, function(i, val) {
            timeObj[matArr[i]] = val;
        });
        $.each(numArr, function(i, val) {
            var mathh = subhh ? mats[3 + i] : mats[i];
            newtime.push(timeObj[mathh]);
        });
        return (jet.IsNum(time)) ? (jet.reMacth(subhh ? time.replace(/(.{2})/g, "$1,") : time.substr(0, 4).replace(/^(\d{4})/g, "$1,") + time.substr(4).replace(/(.{2})/g, "$1,"))) : newtime;
    };
    var searandom = function() {
        var str = "",
            arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
        for (var i = 0; i < 8; i++) str += arr[Math.round(Math.random() * (arr.length - 1))];
        return str;
    };

    function jeDate(elem, opts) {
        this.opts = opts;
        this.valCell = elem;
        this.init();
    }
    var jedfn = jeDate.prototype,
        jefix = "jefixed";
    jedfn.init = function() {
        var that = this,
            opts = that.opts,
            newDate = new Date(),
            jetrigger = opts.trigger != undefined ? opts.trigger : config.trigger,
            zIndex = opts.zIndex == undefined ? 2099 : opts.zIndex,
            isinitVal = (opts.isinitVal == undefined || opts.isinitVal == false) ? false : true;
        jet.fixed = jet.isBool(opts.fixed);
        var fixedCell = (opts.fixedCell == undefined || opts.fixedCell == "") ? "" : "#" + this.opts.fixedCell;
        var arrayContain = function(array, obj) {
            for (var i = 0; i < array.length; i++) {
                if (array[i] == obj) return true;
            }
            return false;
        };
        var initVals = function(objCell) {
            var jeformat = opts.format || config.format,
                jeaddDate,
                inaddVal = opts.initAddVal || {},
                hmsset = opts.hmsSetVal || {};
            //判断时间为20170430这样类型的
            //var isnosepYMD = arrayContain(["YYYYMM","YYYYMMDD","YYYYMMDDhh","YYYYMMDDhhmm","YYYYMMDDhhmmss"],jeformat);
            if (jet.isObj(hmsset)) {
                jeaddDate = jet.parse([newDate.getFullYear(), jet.digit(newDate.getMonth() + 1), jet.digit(newDate.getDate())], [jet.digit(hmsset.hh), jet.digit(hmsset.mm), jet.digit(hmsset.ss)], jeformat);
            } else {
                jeaddDate = jet.returnDate(inaddVal, jeformat);
            }

            (objCell.val() || objCell.text()) == "" ? jet.isValHtml(objCell) ? objCell.val(jeaddDate) : objCell.text(jeaddDate): jet.isValHtml(objCell) ? objCell.val() : objCell.text();
        };
        var formatDate = function(cls, boxcell) {
            var dateDiv = $("<div/>", { "id": boxcell.replace(/\#/g, ""), "class": "jedatebox " + (opts.skinCell || config.skinCell) }),
                reabsfix = $(fixedCell).length > 0 ? "relative" : (jet.fixed == true ? "absolute" : "fixed");
            dateDiv.attr("author", "chen guojun").css({ "z-index": boxcell != "#jedatebox" ? "" : zIndex, "position": reabsfix, "display": "block" });
            if (boxcell != "#jedatebox") dateDiv.attr({ "jeformat": opts.format || config.format, "jefixed": fixedCell });
            jet.minDate = opts.minDate || config.minDate;
            jet.maxDate = opts.maxDate || config.maxDate;
            $(cls).append(dateDiv);
            that.setHtml(opts, boxcell);
        };
        //为开启初始化的时间设置值
        if (isinitVal && jetrigger != false) {
            that.valCell.each(function() {
                initVals($(this));
            });
        }
        //判断固定元素是否存在
        if ($(fixedCell).length > 0) {
            var randomCell = "#jedatebox" + searandom();
            formatDate(fixedCell, randomCell);
        } else {
            //insTrigger的值为true时内部默认点击事件
            var jd = ["body", "#jedatebox"];
            if (jetrigger != false) {
                that.valCell.on(jetrigger, function(ev) {
                    ev.stopPropagation();
                    if ($(jd[1]).length > 0) return;
                    formatDate(jd[0], jd[1]);
                });
            } else {
                formatDate(jd[0], jd[1]);
            }
        }
    };
    //布局控件骨架
    jedfn.setHtml = function(opts, boxcls) {
        jet.boxelem = $($(boxcls).attr(jefix)).length > 0 ? boxcls : "#jedatebox";
        jet.format = $($(boxcls).attr(jefix)).length > 0 ? $(jet.boxelem).attr("jeformat") : (opts.format || config.format);
        jet.formatType = jet.checkFormat(jet.format);
        var that = this,
            boxCell = $(jet.boxelem),
            isYYMM = jet.testFormat(jet.format, "YYYY-MM"),
            isYY = jet.testFormat(jet.format, "YYYY");
        var doudStrHtml = '<div class="jedatetop"></div>' +
            '<div class="jedatetopym" style="display: none;"><ul class="ymdropul"></ul></div>' +
            '<ol class="jedaol"></ol><ul class="' + ((isYYMM || isYY) ? (isYY ? "jedayy" : "jedaym") : "jedaul") + '"></ul>' +
            '<div class="jedateprophms"></div>' +
            '<div class="jedatebot"></div>';
        boxCell.empty().append(doudStrHtml);
        that.generateHtml(opts, boxCell);
    };
    jedfn.isContainhh = function(format) {
        var gethms = jet.checkFormat(format),
            rearr = jet.reMacth("hh-" + gethms.split("hh")[1]);
        return rearr;
    };
    jedfn.generateHtml = function(opts, boxCell) {
        var that = this,
            objCell = that.valCell,
            weekHtml = "",
            tmsArr,
            date = new Date(),
            lang = opts.language || config.language,
            isYYMM = jet.testFormat(jet.format, "YYYY-MM"),
            isYY = jet.testFormat(jet.format, "YYYY"),
            subhh = jet.format.substring(0, 2) == "hh",
            topCell = boxCell.find(".jedatetop"),
            topymCell = boxCell.find(".jedatetopym"),
            olCell = boxCell.find(".jedaol"),
            hmsCell = boxCell.find(".jedateprophms"),
            botCell = boxCell.find(".jedatebot");
        if ((objCell.val() || objCell.text()) == "") {
            //目标为空值则获取当前日期时间
            tmsArr = [date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()];
            jet.currDate = new Date(tmsArr[0], parseInt(tmsArr[1]) - 1, tmsArr[2], tmsArr[3], tmsArr[4], tmsArr[5]);
            jet.ymdDate = tmsArr[0] + "-" + jet.digit(tmsArr[1]) + "-" + jet.digit(tmsArr[2]);
        } else {
            var initVal = jet.isValHtml(objCell) ? objCell.val() : objCell.text();
            var inVals = jet.sortDate(initVal, jet.format);
            if (subhh) {
                tmsArr = [date.getFullYear(), date.getMonth() + 1, date.getDate(), inVals[0], inVals[1] || date.getMinutes(), inVals[2] || date.getSeconds()];
                jet.currDate = new Date(date.getFullYear(), date.getMonth() - 1, date.getDate());
            } else {
                tmsArr = [inVals[0], inVals[1] == undefined ? date.getMonth() + 1 : inVals[1], inVals[2] == undefined ? date.getDate() : inVals[2], inVals[3] == undefined ? date.getHours() : inVals[3], inVals[4] == undefined ? date.getMinutes() : inVals[4], inVals[5] == undefined ? date.getSeconds() : inVals[5]];
                jet.currDate = new Date(tmsArr[0], parseInt(tmsArr[1]) - 1, tmsArr[2], tmsArr[3], tmsArr[4], tmsArr[5]);
                jet.ymdDate = tmsArr[0] + "-" + jet.digit(tmsArr[1]) + "-" + jet.digit(tmsArr[2]);
            }
        }
        //设置date的html片段
        var topStrHtml = '<div class="jedateym" style="width:50%;"><i class="prev triangle monthprev"></i><span class="jedatemm" ym="12"><em class="jedatemonth"></em><em class="pndrop"></em></span><i class="next triangle monthnext"></i></div>' +
            '<div class="jedateym" style="width:50%;"><i class="prev triangle yearprev"></i><span class="jedateyy" ym="24"><em class="jedateyear"></em><em class="pndrop"></em></span><i class="next triangle yearnext"></i></div>';

        var hmsStrHtml = '<div class="jedatepropcon"><div class="jedatehmstitle">' + (lang.name == "cn" ? "\u65F6\u95F4\u9009\u62E9" : "Time to choose") + '<div class="jedatehmsclose">&times;</div></div>' +
            '<div class="jedateproptext">' + lang.times[0] + '</div><div class="jedateproptext">' + lang.times[1] + '</div><div class="jedateproptext">' + lang.times[2] + '</div>' +
            '<div class="jedatehmscon jedateprophours"></div><div class="jedatehmscon jedatepropminutes"></div><div class="jedatehmscon jedatepropseconds"></div></div>';

        var botStrHtml = '<div class="botflex jedatehmsshde"><ul class="jedatehms"><li><input type="text" maxlength="2" numval="23" hms="0"></li><i>:</i><li><input type="text" maxlength="2" numval="59" hms="1"></li><i>:</i><li><input type="text" maxlength="2" numval="59" hms="2"></li></ul></div>' +
            '<div class="botflex jedatebtn"><span class="jedateok">' + lang.yes + '</span><span class="jedatetodaymonth">' + lang.today + '</span><span class="jedateclear">' + lang.clear + '</span></div>';

        var ymBtnHtml = '<p><span class="jedateymchle">&lt;&lt;</span><span class="jedateymchri">&gt;&gt;</span><span class="jedateymchok">' + lang.close + '</span></p>';
        //设置html到对应的DOM中
        if (subhh) {
            boxCell.children(".jedatetop,.jedatetopym,.jedaol,.jedaul").remove();
        } else {
            topCell.append(topStrHtml);
        }
        if (isYYMM || isYY) {
            boxCell.children(".jedatetopym,.jedaol").remove();
            //设置格式为 YYYY-MM 类型的
            botCell.find(".jedatetodaymonth").hide();
            topCell.children().css({ "width": "100%" }).first().remove();
            topCell.children().find(".pndrop").remove();
            boxCell.find(isYYMM ? ".jedaym" : ".jedayy").append(that.eachYM(opts, tmsArr[0], tmsArr[1], boxCell));
        } else {
            topymCell.append(ymBtnHtml);
            olCell.append(function() {
                //设置周显示
                $.each(lang.weeks, function(i, week) {
                    weekHtml += '<li class="weeks" data-week="' + week + '">' + week + "</li>";
                });
                return weekHtml;
            });
        }
        botCell.append(botStrHtml);
        //是否显示清除按钮
        jet.isBool(opts.isClear) ? "" : botCell.find(".jedateclear").hide();
        //是否显示今天按钮
        (isYYMM || isYY || subhh) ? botCell.find(".jedatetodaymonth").hide(): (jet.isBool(opts.isToday) ? "" : botCell.find(".jedatetodaymonth").hide());

        //是否显示确认按钮
        jet.isBool(opts.isok) ? "" : botCell.find(".jedateok").hide();

        //开始循环创建日期--天
        if (/\DD/.test(jet.format)) {
            that.createDaysHtml(tmsArr[0], tmsArr[1], opts, boxCell);
        }
        //设置时分秒
        if (/\hh/.test(jet.format)) {
            hmsCell.append(hmsStrHtml).addClass(subhh ? "jedatepropfix" : "jedateproppos").css({ "display": subhh ? "block" : "none" });
            var hmsarr = that.isContainhh(jet.format),
                hmsset = opts.hmsSetVal || {},
                hmsobj = ((objCell.val() || objCell.text()) == "" && jet.isObj(hmsset)) ? hmsset : { "hh": tmsArr[3], "mm": tmsArr[4], "ss": tmsArr[5] };
            $.each(["hh", "mm", "ss"], function(i, hms) {
                var undezz = (hmsarr[i] == undefined || hmsarr[i] == "zz"),
                    inphms = botCell.find('input[hms=' + i + ']');
                inphms.val(undezz ? "00" : jet.digit(hmsobj[hms])).attr("readOnly", jet.isBool(opts.ishmsVal) ? false : true);
                if (hmsarr.length != 0 && undezz) inphms.attr("disabled", true);
            });
        } else {
            botCell.find(".jedatehmsshde").hide();
            botCell.find(".jedatebtn").css({ width: "100%" });
        }
        //是否开启时间选择
        if (!jet.isBool(opts.isTime)) {
            botCell.find(".botflex").css({ width: "100%" });
            botCell.find(".jedatehmsshde").hide();
        }
        //绑定各个事件
        that.eventsDate(opts, boxCell);
        if ($($(jet.boxelem).attr(jefix)).length == 0) {
            var datepos = opts.position || [];
            datepos.length > 0 ? boxCell.css({ "top": datepos[0], "left": datepos[1] }) : that.orien(boxCell, objCell);
        }
        setTimeout(function() {
            opts.success && opts.success(objCell);
        }, 50);
    };
    //循环生成日历
    jedfn.createDaysHtml = function(ys, ms, opts, boxCell) {
        var that = this,
            year = parseInt(ys),
            month = parseInt(ms),
            dateHtml = "",
            count = 0,
            lang = opts.language || config.language,
            ends = opts.isvalid || [],
            minArr = jet.reMacth(jet.minDate),
            minNum = minArr[0] + minArr[1] + minArr[2],
            maxArr = jet.reMacth(jet.maxDate),
            maxNum = maxArr[0] + maxArr[1] + maxArr[2],
            firstWeek = new Date(year, month - 1, 1).getDay() || 7,
            daysNum = jet.getDaysNum(year, month),
            prevM = jet.getPrevMonth(year, month),
            prevDaysNum = jet.getDaysNum(year, prevM.m),
            nextM = jet.getNextMonth(year, month),
            currOne = jet.currDate.getFullYear() + "-" + jet.digit(jet.currDate.getMonth() + 1) + "-" + jet.digit(1),
            thisOne = year + "-" + jet.digit(month) + "-" + jet.digit(1);
        boxCell.find(".jedateyear").attr("year", year).text(year + (lang.name == "cn" ? "\u5e74" : ""));
        boxCell.find(".jedatemonth").attr("month", month).text(month + (lang.name == "cn" ? "\u6708" : ""));
        //设置时间标注
        var mark = function(my, mm, md) {
            var Marks = opts.marks,
                contains = function(arr, obj) {
                    var len = arr.length;
                    while (len--) {
                        if (arr[len] === obj) return true;
                    }
                    return false;
                };
            return $.isArray(Marks) && Marks.length > 0 && contains(Marks, my + "-" + jet.digit(mm) + "-" + jet.digit(md)) ? '<i class="marks"></i>' : "";
        };
        //是否显示节日
        var isfestival = function(y, m, d) {
            var festivalStr;
            if (opts.festival == true && lang.name == "cn") {
                var lunar = jeLunar(y, m - 1, d),
                    feslunar = (lunar.solarFestival || lunar.lunarFestival),
                    lunartext = (feslunar && lunar.jieqi) != "" ? feslunar : (lunar.jieqi || lunar.showInLunar);
                festivalStr = '<p><span class="solar">' + d + '</span><span class="lunar">' + lunartext + '</span></p>';
            } else {
                festivalStr = '<p class="nolunar">' + d + '</p>';
            }
            return festivalStr;
        };
        //判断是否在限制的日期之中
        var dateOfLimit = function(Y, M, D, isMonth) {
            var thatNum = (Y + "-" + jet.digit(M) + "-" + jet.digit(D)).replace(/\-/g, '');
            if (isMonth) {
                if (parseInt(thatNum) >= parseInt(minNum) && parseInt(thatNum) <= parseInt(maxNum)) return true;
            } else {
                if (parseInt(minNum) > parseInt(thatNum) || parseInt(maxNum) < parseInt(thatNum)) return true;
            }
        };
        //判断禁用启用是长度，并设置成正则
        if (ends.length > 0) {
            var dayreg = new RegExp(ends[0].replace(/,/g, "|"));
        }
        //上一月剩余天数
        for (var p = prevDaysNum - firstWeek + 1; p <= prevDaysNum; p++, count++) {
            var pmark = mark(prevM.y, prevM.m, p),
                pCls;
            if (ends.length > 0) {
                if (dateOfLimit(prevM.y, prevM.m, p, false)) {
                    pCls = "disabled";
                } else {
                    if (dayreg.test(p)) {
                        pCls = ends[1] == true ? "other" : "disabled";
                    } else {
                        pCls = ends[1] == true ? "disabled" : "other";
                    }
                }
            } else {
                pCls = dateOfLimit(prevM.y, prevM.m, p, false) ? "disabled" : "other";
            }
            dateHtml += '<li data-ymd="' + prevM.y + '-' + prevM.m + '-' + p + '" class=' + pCls + '>' + (isfestival(prevM.y, prevM.m, p) + pmark) + '</li>';
        }
        //本月的天数
        for (var b = 1; b <= daysNum; b++, count++) {
            var bCls = "",
                bmark = mark(year, month, b),
                thisDate = (year + "-" + jet.digit(month) + "-" + jet.digit(b)); //本月当前日期
            //判断日期是否在限制范围中，并高亮选中的日期
            if (dateOfLimit(year, month, b, true)) {
                if (ends.length > 0) {
                    if (jet.ymdDate == thisDate) {
                        bCls = jet.ymdDate == thisDate ? "action" : (currOne != thisOne && thisOne == thisDate ? "action" : "");
                    } else {
                        if (dayreg.test(b)) {
                            bCls = ends[1] == true ? "" : "disabled";
                        } else {
                            bCls = ends[1] == true ? "disabled" : "";
                        }
                    }
                } else {
                    bCls = jet.ymdDate == thisDate ? "action" : (currOne != thisOne && thisOne == thisDate ? "action" : "");
                }
            } else {
                bCls = "disabled";
            }
            if (bCls == "action") boxCell.children("ul").attr("dateval", year + '-' + month + '-' + b);
            dateHtml += '<li data-ymd="' + year + '-' + month + '-' + b + '" class=' + (bCls != "" ? bCls : "") + '>' + (isfestival(year, month, b) + bmark) + '</li>';
        }
        //下一月开始天数
        for (var n = 1, nlen = 42 - count; n <= nlen; n++) {
            var nmark = mark(nextM.y, nextM.m, n),
                nCls;
            if (ends.length > 0) {
                if (dateOfLimit(nextM.y, nextM.m, n, false)) {
                    nCls = "disabled";
                } else {
                    if (dayreg.test(n)) {
                        nCls = ends[1] == true ? "other" : "disabled";
                    } else {
                        nCls = ends[1] == true ? "disabled" : "other";
                    }
                }
            } else {
                nCls = dateOfLimit(nextM.y, nextM.m, n, false) ? "disabled" : "other";
            }
            dateHtml += '<li data-ymd="' + nextM.y + '-' + nextM.m + '-' + n + '" class=' + nCls + '>' + (isfestival(nextM.y, nextM.m, n) + nmark) + '</li>';
        }
        //把日期拼接起来并插入
        boxCell.find(".jedaul").empty().html(dateHtml);
        that.chooseDays(opts, boxCell);
    };
    jedfn.eachStrhms = function(opts, boxCell) {
        var that = this,
            hmsArr = [],
            minDates = jet.minDate.split(" "),
            maxDates = jet.maxDate.split(" "),
            mins = minDates[1] == undefined ? "00:00:00" : minDates[1],
            maxs = maxDates[1] == undefined ? "00:00:00" : maxDates[1],
            minDate = minDates[0],
            maxDate = maxDates[0],
            minhms = jet.reMacth(mins),
            maxhms = jet.reMacth(maxs);
        //生成时分秒
        $.each([24, 60, 60], function(i, len) {
            var hmsStr = "",
                hmsCls = "",
                hmsarr = that.isContainhh(jet.format),
                inputs = boxCell.find(".jedatehms input"),
                textem = inputs.eq(i).val();
            for (var h = 0; h < len; h++) {
                h = jet.digit(h);
                if (jet.isBool(opts.hmsLimit)) {
                    hmsCls = (hmsarr.length != 0 && (hmsarr[i] == undefined || hmsarr[i] == "zz")) ? "disabled" : (textem == h ? "action" : "");
                    if (hmsarr.length != 0 && (hmsarr[i] == undefined || hmsarr[i] == "zz")) {
                        hmsCls = "disabled";
                    } else {
                        var current = jet.ymdDate + " ",
                            min = minDate + " ",
                            max = maxDate + " ";
                        for (var j = 0; j <= i; j++) {
                            if (j == i) {
                                current += h + ":";
                            } else {
                                current += inputs.eq(j).val() + ":";
                            }
                            min += minhms[j] + ":";
                            max += maxhms[j] + ":";
                        }
                        current = new Date(current);
                        min = new Date(min);
                        max = new Date(max);

                        if (current < min || current > max) {
                            hmsCls = h == textem ? "disabled action" : "disabled";
                        } else {
                            hmsCls = h == textem ? "action" : "";
                        }
                    }
                } else {
                    //判断限制时间范围的状态
                    if (h < minhms[i] || h > maxhms[i]) {
                        hmsCls = h == textem ? "disabled action" : "disabled";
                    } else {
                        hmsCls = h == textem ? "action" : "";
                    };
                }
                hmsStr += '<p class="' + hmsCls + '">' + h + "</p>";
            }
            hmsArr.push(hmsStr);
        });
        return hmsArr;
    };
    //循环生成年或月
    jedfn.eachYM = function(opts, y, m, boxCell) {
        var ymStr = "",
            lang = opts.language || config.language,
            ymtext,
            objCell = this.valCell,
            date = new Date();
        if (jet.testFormat(jet.format, "YYYY")) {
            jet.yearArr = new Array(15);
            $.each(jet.yearArr, function(i) {
                var minArr = jet.parseMatch(jet.minDate),
                    maxArr = jet.parseMatch(jet.maxDate),
                    minY = minArr[0],
                    maxY = maxArr[0],
                    year = y - 7 + i,
                    objyear = jet.reMacth(jet.isValHtml(objCell) ? objCell.val() : objCell.text()),
                    getyear = ((objCell.val() || objCell.text()) == "") ? date.getFullYear() : objyear[0];
                if (year < minY || year > maxY) {
                    ymStr += "<li class='disabled' yy='" + year + "'>" + year + "</li>";
                } else {
                    ymStr += "<li class='" + (parseInt(getyear) == year ? "action" : "") + "' yy='" + year + "'>" + year + "</li>";
                }
                if (parseInt(getyear) == year) boxCell.children("ul").attr("dateval", year);
            });
            ymtext = y;
        } else {
            $.each(lang.month, function(i, val) {
                var minArr = jet.parseMatch(jet.minDate),
                    maxArr = jet.parseMatch(jet.maxDate),
                    thisDate = new Date(y, jet.digit(val), "01"),
                    minTime = new Date(minArr[0], minArr[1], minArr[2]),
                    maxTime = new Date(maxArr[0], maxArr[1], maxArr[2]);
                if (thisDate < minTime || thisDate > maxTime) {
                    ymStr += "<li class='disabled' ym='" + y + "-" + jet.digit(val) + "'>" + y + "-" + jet.digit(val) + "</li>";
                } else {
                    ymStr += "<li class='" + (m == val ? "action" : "") + "' ym='" + y + "-" + jet.digit(val) + "'>" + y + "-" + jet.digit(val) + "</li>";
                }
                if (m == val) boxCell.children("ul").attr("dateval", y + "-" + jet.digit(val));
            });
            ymtext = y + "-" + jet.digit(m);
        }
        boxCell.find(".jedatetop .jedateyear").text(ymtext);
        return ymStr;
    };
    //方位辨别
    jedfn.orien = function(obj, self, pos) {
        var tops, leris, ortop, orleri, rect = jet.fixed ? self[0].getBoundingClientRect() : obj[0].getBoundingClientRect();
        if (jet.fixed) {
            //根据目标元素计算弹层位置
            leris = rect.right + obj.outerWidth() / 1.5 >= jet.winarea(1) ? rect.right - obj.outerWidth() : rect.left + (pos ? 0 : jet.docScroll(1));
            tops = rect.bottom + obj.outerHeight() / 1 <= jet.winarea() ? rect.bottom - 1 : rect.top > obj.outerHeight() / 1.5 ? rect.top - obj.outerHeight() - 1 : jet.winarea() - obj.outerHeight();
            ortop = Math.max(tops + (pos ? 0 : jet.docScroll()) + 1, 1) + "px", orleri = leris + "px";
        } else {
            //弹层位置位于页面上下左右居中
            ortop = "50%", orleri = "50%";
            obj.css({ "margin-top": -(rect.height / 2), "margin-left": -(rect.width / 2) });
        }
        obj.css({ "top": ortop, "left": orleri });
    };
    //农历方位辨别
    jedfn.lunarOrien = function(obj, self, pos) {
        var tops, leris, ortop, orleri, rect = self[0].getBoundingClientRect();
        leris = rect.right + obj[0].offsetWidth / 1.5 >= jet.winarea(1) ? rect.right - obj[0].offsetWidth : rect.left + (pos ? 0 : jet.docScroll(1));
        tops = rect.bottom + obj[0].offsetHeight / 1 <= jet.winarea() ? rect.bottom - 1 : rect.top > obj[0].offsetHeight / 1.5 ? rect.top - obj[0].offsetHeight - 1 : jet.winarea() - obj[0].offsetHeight;
        ortop = Math.max(tops + (pos ? 0 : jet.docScroll()) + 1, 1) + "px", orleri = leris + "px";
        return { top: ortop, left: orleri }
    };
    //关闭层
    jedfn.dateClose = function() {
        if ($($(jet.boxelem).attr(jefix)).length == 0) {
            $(jet.boxelem).remove();
        }
    };
    // 提示层
    jedfn.notice = function(text, boxCell) {
        var container = boxCell.find('.jedatenotice');
        container.html(text);
        container.show();
        setTimeout(function() {
            container.hide();
        }, 2000);
    };
    //为日期绑定各类事件
    jedfn.eventsDate = function(opts, boxCell) {
        var that = this,
            elemCell = that.valCell,
            lang = opts.language || config.language,
            ishhmat = jet.checkFormat(jet.format).substring(0, 2) == "hh";
        if (!ishhmat) {
            that.chooseYearMonth(opts, boxCell);
        }
        if (jet.testFormat(jet.format, "YYYY") || jet.testFormat(jet.format, "YYYY-MM")) {
            that.preNextYearMonth(opts, boxCell);
            that.onlyYMevents(opts, boxCell);
        }
        //判断日期格式中是否包小时（hh）
        if (/\hh/.test(jet.format)) {
            var hsCls = boxCell.find(".jedateprophours"),
                msCls = boxCell.find(".jedatepropminutes"),
                ssCls = boxCell.find(".jedatepropseconds"),
                prophms = boxCell.find(".jedateprophms"),
                screlTopNum = 155;
            var sethmsStrHtml = function() {
                var hmsStr = that.eachStrhms(opts, boxCell),
                    hmsarr = that.isContainhh(jet.format);
                prophms.css("display", "block");
                $.each([hsCls, msCls, ssCls], function(i, hmsCls) {
                    if (hmsCls.html() == "") hmsCls.html(hmsStr[i]);
                });
                //计算当前时分秒的位置
                $.each(["hours", "minutes", "seconds"], function(i, hms) {
                    var hmsCls = boxCell.find(".jedateprop" + hms),
                        achmsCls = hmsCls.find(".action"),
                        onhmsPCls = hmsCls.find("p");
                    if (hmsarr.length != 0 && (hmsarr[i] != undefined && hmsarr[i] != "zz")) {
                        hmsCls[0].scrollTop = achmsCls[0].offsetTop - screlTopNum;
                    }
                    onhmsPCls.on("click", function() {
                        var _this = $(this);
                        if (_this.hasClass("disabled")) return;
                        _this.addClass('action').siblings().removeClass('action');
                        boxCell.find(".jedatebot .jedatehms input").eq(i).val(jet.digit(_this.text()));
                        if (!ishhmat) boxCell.find(".jedateprophms").hide();
                    });
                })

            };
            //如果日期格式中前2个否包小时（hh），就直接显示，否则点击显示
            if (ishhmat) {
                sethmsStrHtml();
                prophms.find(".jedatehmsclose").css("display", "none");
            } else {
                boxCell.find(".jedatehms").on("click", function() {
                    sethmsStrHtml();
                    //关闭时分秒层
                    !ishhmat && prophms.find(".jedatehmsclose").on("click", function() {
                        prophms.css("display", "none");
                    });
                })
            }
        }
        //检查时间输入值，并对应到相应位置
        boxCell.find(".jedatehms input").on("keyup", function() {
            var _this = $(this),
                thatval = _this.val(),
                hmsarr = that.isContainhh(jet.format),
                hmsVal = parseInt(_this.attr("numval")),
                thatitem = parseInt(_this.attr("hms"));
            _this.val(thatval.replace(/\D/g, ""));
            //判断输入值是否大于所设值
            if (thatval > hmsVal) {
                _this.val(hmsVal);
                var onval = lang.name == "cn" ? "\u8F93\u5165\u503C\u4E0D\u80FD\u5927\u4E8E " : "The input value is not greater than ";
                alert(onval + hmsVal);
            }
            if (thatval == "") _this.val("00");
            boxCell.find(".jedatehmscon").eq(thatitem).children().each(function() {
                $(this).removeClass("action");
            });
            boxCell.find(".jedatehmscon").eq(thatitem).children().eq(parseInt(_this.val().replace(/^0/g, ''))).addClass("action");
            $.each(["hours", "minutes", "seconds"], function(i, hms) {
                var hmsCls = boxCell.find(".jedateprop" + hms),
                    achmsCls = hmsCls.find(".action");
                if (hmsarr.length != 0 && hmsarr[i] != undefined) {
                    hmsCls[0].scrollTop = achmsCls[0].offsetTop - screlTopNum;
                }
            });
        });
        //清空按钮清空日期时间
        boxCell.find(".jedatebot .jedateclear").on("click", function(ev) {
            ev.stopPropagation();
            var clearVal = jet.isValHtml(elemCell) ? elemCell.val() : elemCell.text();
            jet.isValHtml(elemCell) ? elemCell.val("") : elemCell.text("");
            that.dateClose();
            if (clearVal != "") {
                if (jet.isBool(opts.clearRestore)) {
                    jet.minDate = opts.startMin || jet.minDate;
                    jet.maxDate = opts.startMax || jet.maxDate;
                }
                if ($.isFunction(opts.clearfun) || opts.clearfun != null) opts.clearfun(elemCell, clearVal);
            }
        });
        //今天按钮设置日期时间
        boxCell.find(".jedatebot .jedatetodaymonth").on("click", function() {
            var newDate = new Date(),
                toTime = [newDate.getFullYear(), newDate.getMonth() + 1, newDate.getDate(), newDate.getHours(), newDate.getMinutes(), newDate.getSeconds()],
                gettoDate = jet.parse([toTime[0], toTime[1], toTime[2]], [toTime[3], toTime[4], toTime[5]], jet.format),
                toDate = newDate.getFullYear() + "-" + jet.digit(newDate.getMonth() + 1) + "-" + jet.digit(newDate.getDate()) + " " + jet.digit(newDate.getHours()) + ":" + jet.digit(newDate.getMinutes()) + ":" + jet.digit(newDate.getSeconds());

            jet.isValHtml(elemCell) ? elemCell.val(gettoDate) : jet.text(gettoDate);
            if ($(boxCell.attr(jefix)).length > 0) {
                var fixCell = "#" + boxCell.attr("id");
                that.setHtml(opts, fixCell);
            }
            that.dateClose();
            if ($.isFunction(opts.choosefun) || opts.choosefun != null) opts.choosefun(elemCell, gettoDate, toDate);
        });
        //确认按钮设置日期时间
        boxCell.find(".jedatebot .jedateok").on("click", function(ev) {
            ev.stopPropagation();
            var date = new Date(),
                okhms = (function() {
                    var hmsArr = [];
                    boxCell.find(".jedatehms input").each(function() {
                        var disattr = $(this).attr('disabled');
                        if (typeof(disattr) == "undefined") hmsArr.push($(this).val());
                    });
                    return hmsArr;
                })(),
                datevalue = boxCell.children("ul").attr("dateval");
            var okymd = ishhmat ? [date.getFullYear(), date.getMonth() + 1, date.getDate()] : jet.reMacth(datevalue),
                okformat = $($(jet.boxelem).attr(jefix)).length > 0 ? boxCell.attr("jeformat") : jet.format,
                okVal = jet.parse([parseInt(okymd[0]), parseInt(okymd[1]), parseInt(okymd[2])], [okhms[0] || 00, okhms[1] || 00, okhms[2] || 00], okformat),
                okdate = (okymd[0] || date.getFullYear()) + "-" + jet.digit(okymd[1] || date.getMonth() + 1) + "-" + jet.digit(okymd[2] || date.getDate()) + " " + jet.digit(okhms[0] || 00) + ":" + jet.digit(okhms[1] || 00) + ":" + jet.digit(okhms[2] || 00);

            jet.isValHtml(elemCell) ? elemCell.val(okVal) : elemCell.text(okVal);
            that.dateClose();
            if ($.isFunction(opts.okfun) || opts.okfun != null) opts.okfun(elemCell, okVal, okdate);
        });
        //点击空白处隐藏
        $(document).on("mouseup scroll", function(ev) {
            ev.stopPropagation();
            if (ev.type === 'scroll' && !jet.isBool(opts.isdocScroll)) return;
            if (jet.boxelem == "#jedatebox") {
                var box = $(jet.boxelem);
                if (box && box.css("display") !== "none") box.remove();
                if ($("#jedatetipscon").length > 0) $("#jedatetipscon").remove();
            }
        });
        $(jet.boxelem).on("mouseup", function(ev) {
            ev.stopPropagation();
        });
    };
    //选择日期
    jedfn.chooseDays = function(opts, boxCell) {
        var that = this,
            objCell = that.valCell,
            date = new Date(),
            lang = opts.language || config.language;
        boxCell.find(".jedaul li").on("click", function(ev) {
            var thisformat = $(boxCell.attr(jefix)).length > 0 ? boxCell.attr("jeformat") : jet.format;
            var _that = $(this),
                liTms = [];
            if (_that.hasClass("disabled")) return;
            ev.stopPropagation();
            //获取时分秒的集合
            boxCell.find(".jedatehms input").each(function() {
                liTms.push($(this).val());
            });
            var dateArr = jet.reMacth(_that.attr("data-ymd")),
                getDateVal = jet.parse([dateArr[0], dateArr[1], dateArr[2]], [liTms[0], liTms[1], liTms[2]], thisformat),
                wdate = (dateArr[0] || date.getFullYear()) + "-" + jet.digit(dateArr[1] || date.getMonth() + 1) + "-" + jet.digit(dateArr[2] || date.getDate()) + " " + jet.digit(liTms[0]) + ":" + jet.digit(liTms[1]) + ":" + jet.digit(liTms[2]);
            jet.isValHtml(objCell) ? objCell.val(getDateVal) : objCell.text(getDateVal);
            if ($(boxCell.attr(jefix)).length > 0) {
                var fixCell = "#" + boxCell.attr("id");
                that.setHtml(opts, fixCell);
            } else {
                that.dateClose();
            }
            opts.festival && $("#jedatetipscon").remove();
            if ($.isFunction(opts.choosefun) || opts.choosefun != null) {
                opts.choosefun && opts.choosefun(objCell, getDateVal, wdate);
            }
        });
        if (opts.festival && lang.name == "cn") {
            //鼠标进入提示框出现
            boxCell.find(".jedaul li").on("mouseover", function() {
                var _this = $(this),
                    atlunar = jet.reMacth(_this.attr("data-ymd")),
                    tipDiv = $("<div/>", { "id": "jedatetipscon", "class": "jedatetipscon" }),
                    lunar = jeLunar(parseInt(atlunar[0]), parseInt(atlunar[1]) - 1, parseInt(atlunar[2]));
                var tiphtml = '<p>' + lunar.solarYear + '\u5E74' + lunar.solarMonth + '\u6708' + lunar.solarDate + '\u65E5 ' + lunar.inWeekDays + '</p><p class="red">\u519C\u5386：' + lunar.shengxiao + '\u5E74 ' + lunar.lnongMonth + '\u6708' + lunar.lnongDate + '</p><p>' + lunar.ganzhiYear + '\u5E74 ' + lunar.ganzhiMonth + '\u6708 ' + lunar.ganzhiDate + '\u65E5</p>';
                var Fesjieri = (lunar.solarFestival || lunar.lunarFestival) != "" ? '<p class="red">' + ("\u8282\u65E5：" + lunar.solarFestival + lunar.lunarFestival) + '</p>' : "";
                var Fesjieqi = lunar.jieqi != "" ? '<p class="red">' + (lunar.jieqi != "" ? "\u8282\u6C14：" + lunar.jieqi : "") + '</p>' : "";
                var tiptext = (lunar.solarFestival || lunar.lunarFestival || lunar.jieqi) != "" ? (Fesjieri + Fesjieqi) : "";
                //生成提示框到文档中
                $("body").append(tipDiv);
                tipDiv.html(tiphtml + tiptext);
                //获取并设置农历提示框出现的位置
                var tipPos = jedfn.lunarOrien(tipDiv, _this);
                tipDiv.css({ "z-index": (opts.zIndex == undefined ? 2099 + 5 : opts.zIndex + 5), top: tipPos.top, left: tipPos.left, position: "absolute", display: "block" });
            }).on("mouseout", function() { //鼠标移除提示框消失
                if ($("#jedatetipscon").length > 0) $("#jedatetipscon").remove();
            });
        }
    };
    //切换年月 与 下拉选择年月的事件
    jedfn.chooseYearMonth = function(opts, boxCell) {
        var that = this,
            yPre = boxCell.find(".yearprev"),
            yNext = boxCell.find(".yearnext"),
            mPre = boxCell.find(".monthprev"),
            mNext = boxCell.find(".monthnext"),
            jetopym = boxCell.find(".jedatetopym"),
            jedateyy = boxCell.find(".jedateyy"),
            jedatemm = boxCell.find(".jedatemm"),
            jedateyear = boxCell.find(".jedateyy .jedateyear"),
            jedatemonth = boxCell.find(".jedatemm .jedatemonth"),
            lang = opts.language || config.language,
            mchri = boxCell.find(".jedateymchri"),
            mchle = boxCell.find(".jedateymchle");
        var minArr = jet.reMacth(jet.minDate),
            minNum = minArr[0] + minArr[1],
            maxArr = jet.reMacth(jet.maxDate),
            maxNum = maxArr[0] + maxArr[1];
        //循环生成年
        var eachYears = function(YY) {
                var eachStr = "",
                    ycls;
                $.each(new Array(15), function(i, v) {
                    if (i === 7) {
                        var getyear = jedateyear.attr("year");
                        ycls = (parseInt(YY) >= parseInt(minArr[0]) && parseInt(YY) <= parseInt(maxArr[0])) ? (getyear == YY ? 'class="action"' : "") : 'class="disabled"';
                        eachStr += "<li " + ycls + ' yy="' + YY + '">' + (YY + (lang.name == "cn" ? "\u5e74" : "")) + "</li>";
                    } else {
                        ycls = (parseInt(YY - 7 + i) >= parseInt(minArr[0]) && parseInt(YY - 7 + i) <= parseInt(maxArr[0])) ? "" : 'class="disabled"';
                        eachStr += '<li ' + ycls + ' yy="' + (YY - 7 + i) + '">' + (YY - 7 + i + (lang.name == "cn" ? "\u5e74" : "")) + "</li>";
                    }
                });
                return eachStr;
            },
            //循环生成月
            eachYearMonth = function(YY, ymlen) {
                var ymStr = "";
                if (ymlen == 12) {
                    $.each(lang.month, function(i, val) {
                        var getmonth = jedatemonth.attr("month"),
                            val = jet.digit(val);
                        var mcls = (parseInt(jedateyear.attr("year") + val) >= parseInt(minNum) && parseInt(jedateyear.attr("year") + val) <= parseInt(maxNum)) ? (jet.digit(getmonth) == val ? "action" : "") : "disabled";
                        ymStr += "<li class='" + mcls + "' mm='" + val + "'>" + (val + (lang.name == "cn" ? "\u6708" : "")) + "</li>";
                    });
                    $.each([mchri, mchle], function(c, cls) {
                        cls.hide();
                    });
                } else {
                    ymStr = eachYears(YY);
                    $.each([mchri, mchle], function(c, cls) {
                        cls.show();
                    });
                }
                jetopym.removeClass(ymlen == 12 ? "jedatesety" : "jedatesetm").addClass(ymlen == 12 ? "jedatesetm" : "jedatesety");
                boxCell.find(".jedatetopym .ymdropul").html(ymStr);
                jetopym.show();
            };
        //切换年
        $.each([yPre, yNext], function(i, cls) {
            cls.on("click", function(ev) {
                if (boxCell.find(".jedatetopym").css("display") == "block") return;
                ev.stopPropagation();
                var year = parseInt(jedateyear.attr("year")),
                    month = parseInt(jedatemonth.attr("month")),
                    pnYear = cls == yPre ? --year : ++year;
                that.createDaysHtml(pnYear, month, opts, boxCell);
            });
        });
        //切换月
        $.each([mPre, mNext], function(i, cls) {
            cls.on("click", function(ev) {
                if (boxCell.find(".jedatetopym").css("display") == "block") return;
                ev.stopPropagation();
                var year = parseInt(jedateyear.attr("year")),
                    month = parseInt(jedatemonth.attr("month")),
                    PrevYM = jet.getPrevMonth(year, month),
                    NextYM = jet.getNextMonth(year, month);
                cls == mPre ? that.createDaysHtml(PrevYM.y, PrevYM.m, opts, boxCell) : that.createDaysHtml(NextYM.y, NextYM.m, opts, boxCell);
            });
        });
        //下拉选择 年或月
        $.each([jedateyy, jedatemm], function(i, cls) {
            cls.on("click", function() {
                var clsthat = $(this),
                    ymVal = clsthat.attr("ym"),
                    yearAttr = parseInt(jedateyear.attr("year")),
                    dropchoose = function() {
                        boxCell.find(".ymdropul li").on("click", function(ev) {
                            var _this = $(this),
                                Years = jedateyy == cls ? parseInt(_this.attr("yy")) : parseInt(jedateyear.attr("year")),
                                Months = jedateyy == cls ? parseInt(jedatemonth.attr("month")) : jet.digit(parseInt(_this.attr("mm")));
                            if (_this.hasClass("disabled")) return;
                            ev.stopPropagation();
                            if (jedateyy == cls) {
                                jedateyear.attr("year", Years).html(Years + (lang.name == "cn" ? "\u5e74" : ""));
                            } else {
                                jedatemonth.attr("month", Months).html(Months + (lang.name == "cn" ? "\u6708" : ""));
                            }
                            jetopym.hide();
                            that.createDaysHtml(Years, Months, opts, boxCell);
                        });
                    };
                eachYearMonth(yearAttr, ymVal);
                dropchoose();
                //关闭下拉选择
                boxCell.find(".jedateymchok").on("click", function(ev) {
                    ev.stopPropagation();
                    jetopym.hide();
                });
                $.each([mchle, mchri], function(d, mcls) {
                    mcls.on("click", function(ev) {
                        ev.stopPropagation();
                        d == 0 ? yearAttr -= 15 : yearAttr += 15;
                        var mchStr = eachYears(yearAttr);
                        boxCell.find(".jedatetopym .ymdropul").html(mchStr);
                        dropchoose();
                    });
                });
            })
        });

    };
    //年月情况下的事件绑定
    jedfn.preNextYearMonth = function(opts, boxCell) {
        var that = this,
            elemCell = that.valCell,
            newDate = new Date(),
            isYY = jet.testFormat(jet.format, "YYYY"),
            ymCls = boxCell.find(isYY ? ".jedayy li" : ".jedaym li");
        //选择年月
        ymCls.on("click", function(ev) {
            if ($(this).hasClass("disabled")) return; //判断是否为禁选状态
            ev.stopPropagation();
            var atYM = isYY ? jet.reMacth($(this).attr("yy")) : jet.reMacth($(this).attr("ym")),
                getYMDate = isYY ? jet.parse([atYM[0], newDate.getMonth() + 1, 1], [0, 0, 0], jet.format) : jet.parse([atYM[0], atYM[1], 1], [0, 0, 0], jet.format);
            jet.isValHtml(elemCell) ? elemCell.val(getYMDate) : elemCell.text(getYMDate);
            that.dateClose();
            if ($.isFunction(opts.choosefun) || opts.choosefun != null) opts.choosefun(elemCell, getYMDate);
        });
    };
    //仅年月情况下的点击
    jedfn.onlyYMevents = function(opts, boxCell) {
        var that = this,
            ymVal, newDate = new Date(),
            isYY = jet.testFormat(jet.format, "YYYY"),
            ymPre = boxCell.find(".jedateym .prev"),
            ymNext = boxCell.find(".jedateym .next"),
            onymVal = jet.reMacth(boxCell.children("ul").attr("dateval")),
            ony = parseInt(onymVal[0]),
            onm = parseInt(onymVal[1]);
        $.each([ymPre, ymNext], function(i, cls) {
            cls.on("click", function(ev) {
                ev.stopPropagation();
                if (isYY) {
                    ymVal = cls == ymPre ? boxCell.find(".jedayy li").eq(0).attr("yy") : boxCell.find(".jedayy li").eq(jet.yearArr.length - 1).attr("yy");
                    boxCell.find(".jedayy").html(that.eachYM(opts, ymVal, newDate.getMonth() + 1, boxCell));
                } else {
                    ymVal = cls == ymPre ? ony -= 1 : ony += 1;
                    boxCell.find(".jedaym").html(that.eachYM(opts, ymVal, onm, boxCell));
                }
                that.preNextYearMonth(opts, boxCell);
            });
        });
    };
    //日期控件版本
    $.dateVer = "3.8.5";
    //返回指定日期
    $.nowDate = function(str, format, date) {
        format = format || 'YYYY-MM-DD hh:mm:ss';
        date = date || [];
        if (typeof(str) === 'number') {
            str = { DD: str };
        }
        return jet.returnDate(str, format, date);
    };
    $.timeStampDate = function(date, bool, format) {
        format = format || 'YYYY-MM-DD hh:mm:ss';
        if (bool == true) { //将时间戳转换成日期
            var setdate = new Date(parseInt(date.substring(0, 10)) * 1e3);
            return jet.parse([setdate.getFullYear(), jet.digit(setdate.getMonth()), jet.digit(setdate.getDate())], [jet.digit(setdate.getHours()), jet.digit(setdate.getMinutes()), jet.digit(setdate.getSeconds())], format);
        } else { //将日期转换成时间戳
            var tmsArr = jet.reMacth(date),
                newdate = new Date(tmsArr[0], tmsArr[1], tmsArr[2], tmsArr[3], tmsArr[4], tmsArr[5]),
                timeStr = newdate.getTime().toString();
            return timeStr.substr(0, 10);
        }
    };
    //分解时间
    $.splitDate = function(str) {
        var sdate = str.match(/\w+|d+/g);
        return {
            YYYY: parseInt(sdate[0]),
            MM: parseInt(sdate[1]) || 00,
            DD: parseInt(sdate[2]) || 00,
            hh: parseInt(sdate[3]) || 00,
            mm: parseInt(sdate[4]) || 00,
            ss: parseInt(sdate[5]) || 00
        };
    };
    //获取年月日星期
    $.getLunar = function(time) {
        if (/\YYYY-MM-DD/.test(jet.formatType)) {
            //如果为数字类型的日期对获取到日期的进行替换
            var nocharDate = time.substr(0, 4).replace(/^(\d{4})/g, "$1,") + time.substr(4).replace(/(.{2})/g, "$1,"),
                warr = jet.IsNum(time) ? jet.reMacth(nocharDate) : jet.reMacth(time),
                lunars = jeLunar(warr[0], warr[1] - 1, warr[2]);
            return {
                nMonth: lunars.lnongMonth, //农历月
                nDays: lunars.lnongDate, //农历日
                yYear: parseInt(lunars.solarYear), //阳历年
                yMonth: parseInt(lunars.solarMonth), //阳历月
                yDays: parseInt(lunars.solarDate), //阳历日
                cWeek: lunars.inWeekDays, //汉字星期几
                nWeek: lunars.solarWeekDay //数字星期几
            };
        }
    };
    return jeDate;
});

//农历数据
;
(function(root, factory) {
    root.jeLunar = factory(root.jeLunar);
})(this, function(jeLunar) {
    var lunarInfo = [19416, 19168, 42352, 21717, 53856, 55632, 91476, 22176, 39632, 21970, 19168, 42422, 42192, 53840, 119381, 46400, 54944, 44450, 38320, 84343, 18800, 42160, 46261, 27216, 27968, 109396, 11104, 38256, 21234, 18800, 25958, 54432, 59984, 28309, 23248, 11104, 100067, 37600, 116951, 51536, 54432, 120998, 46416, 22176, 107956, 9680, 37584, 53938, 43344, 46423, 27808, 46416, 86869, 19872, 42448, 83315, 21200, 43432, 59728, 27296, 44710, 43856, 19296, 43748, 42352, 21088, 62051, 55632, 23383, 22176, 38608, 19925, 19152, 42192, 54484, 53840, 54616, 46400, 46496, 103846, 38320, 18864, 43380, 42160, 45690, 27216, 27968, 44870, 43872, 38256, 19189, 18800, 25776, 29859, 59984, 27480, 21952, 43872, 38613, 37600, 51552, 55636, 54432, 55888, 30034, 22176, 43959, 9680, 37584, 51893, 43344, 46240, 47780, 44368, 21977, 19360, 42416, 86390, 21168, 43312, 31060, 27296, 44368, 23378, 19296, 42726, 42208, 53856, 60005, 54576, 23200, 30371, 38608, 19415, 19152, 42192, 118966, 53840, 54560, 56645, 46496, 22224, 21938, 18864, 42359, 42160, 43600, 111189, 27936, 44448],
        sTermInfo = [0, 21208, 43467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758];
    var Gan = "甲乙丙丁戊己庚辛壬癸",
        Zhi = "子丑寅卯辰巳午未申酉戌亥",
        Animals = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
    var solarTerm = ["小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满",
        "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"
    ];
    var nStr1 = "日一二三四五六七八九十",
        nStr2 = "初十廿卅",
        nStr3 = ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "腊"],
        sFtv1 = {
            "0101": "*1元旦节",
            "0202": "湿地日",
            "0214": "情人节",
            "0308": "妇女节",
            "0312": "植树节",
            "0315": "消费者权益日",
            "0401": "愚人节",
            "0422": "地球日",
            "0501": "*1劳动节",
            "0504": "青年节",
            "0512": "护士节",
            "0518": "博物馆日",
            "0520": "母亲节",
            "0601": "儿童节",
            "0623": "奥林匹克日",
            "0630": "父亲节",
            "0701": "建党节",
            "0801": "建军节",
            "0903": "抗战胜利日",
            "0910": "教师节",
            "1001": "*3国庆节",
            "1201": "艾滋病日",
            "1224": "平安夜",
            "1225": "圣诞节"
        },
        sFtv2 = {
            "0100": "除夕",
            "0101": "*2春节",
            "0115": "元宵节",
            "0505": "*1端午节",
            "0707": "七夕节",
            "0715": "中元节",
            "0815": "*1中秋节",
            "0909": "*1重阳节",
            "1015": "下元节",
            "1208": "腊八节",
            "1223": "小年"

        };

    function flunar(Y) {
        var sTerm = function(j, i) {
                var h = new Date((31556925974.7 * (j - 1900) + sTermInfo[i] * 60000) + Date.UTC(1900, 0, 6, 2, 5));
                return (h.getUTCDate())
            },
            d = function(k) {
                var h, j = 348;
                for (h = 32768; h > 8; h >>= 1) {
                    j += (lunarInfo[k - 1900] & h) ? 1 : 0;
                }
                return (j + b(k))
            },
            ymdCyl = function(h) {
                return (Gan.charAt(h % 10) + Zhi.charAt(h % 12))
            },
            b = function(h) {
                var islp = (g(h)) ? ((lunarInfo[h - 1900] & 65536) ? 30 : 29) : (0);
                return islp
            },
            g = function(h) {
                return (lunarInfo[h - 1900] & 15)
            },
            e = function(i, h) {
                return ((lunarInfo[i - 1900] & (65536 >> h)) ? 30 : 29)
            },
            newymd = function(m) {
                var k, j = 0,
                    h = 0,
                    l = new Date(1900, 0, 31),
                    n = (m - l) / 86400000;
                this.dayCyl = n + 40;
                this.monCyl = 14;
                for (k = 1900; k < 2050 && n > 0; k++) {
                    h = d(k);
                    n -= h;
                    this.monCyl += 12;
                }
                if (n < 0) {
                    n += h;
                    k--;
                    this.monCyl -= 12;
                }
                this.year = k;
                this.yearCyl = k - 1864;
                j = g(k);
                this.isLeap = false;
                for (k = 1; k < 13 && n > 0; k++) {
                    if (j > 0 && k == (j + 1) && this.isLeap == false) {
                        --k;
                        this.isLeap = true;
                        h = b(this.year);
                    } else {
                        h = e(this.year, k);
                    }
                    if (this.isLeap == true && k == (j + 1)) {
                        this.isLeap = false;
                    }
                    n -= h;
                    if (this.isLeap == false) this.monCyl++;
                }
                if (n == 0 && j > 0 && k == j + 1) {
                    if (this.isLeap) {
                        this.isLeap = false;
                    } else {
                        this.isLeap = true;
                        --k;
                        --this.monCyl;
                    }
                }
                if (n < 0) {
                    n += h;
                    --k;
                    --this.monCyl
                }
                this.month = k;
                this.day = n + 1;
            },
            digit = function(num) {
                return num < 10 ? "0" + (num | 0) : num;
            },
            reymd = function(i, j) {
                var h = i;
                return j.replace(/dd?d?d?|MM?M?M?|yy?y?y?/g, function(k) {
                    switch (k) {
                        case "yyyy":
                            var l = "000" + h.getFullYear();
                            return l.substring(l.length - 4);
                        case "dd":
                            return digit(h.getDate());
                        case "d":
                            return h.getDate().toString();
                        case "MM":
                            return digit((h.getMonth() + 1));
                        case "M":
                            return h.getMonth() + 1;
                    }
                })
            },
            lunarMD = function(i, h) {
                var j;
                switch (i, h) {
                    case 10:
                        j = "初十";
                        break;
                    case 20:
                        j = "二十";
                        break;
                    case 30:
                        j = "三十";
                        break;
                    default:
                        j = nStr2.charAt(Math.floor(h / 10));
                        j += nStr1.charAt(h % 10);
                }
                return (j)
            };
        this.isToday = false;
        this.isRestDay = false;
        this.solarYear = reymd(Y, "yyyy");
        this.solarMonth = reymd(Y, "M");
        this.solarDate = reymd(Y, "d");
        this.solarWeekDay = Y.getDay();
        this.inWeekDays = "星期" + nStr1.charAt(this.solarWeekDay);
        var X = new newymd(Y);
        this.lunarYear = X.year;
        this.shengxiao = Animals.charAt((this.lunarYear - 4) % 12);
        this.lunarMonth = X.month;
        this.lunarIsLeapMonth = X.isLeap;
        this.lnongMonth = this.lunarIsLeapMonth ? "闰" + nStr3[X.month - 1] : nStr3[X.month - 1];
        this.lunarDate = X.day;
        this.showInLunar = this.lnongDate = lunarMD(this.lunarMonth, this.lunarDate);
        if (this.lunarDate == 1) {
            this.showInLunar = this.lnongMonth + "月";
        }
        this.ganzhiYear = ymdCyl(X.yearCyl);
        this.ganzhiMonth = ymdCyl(X.monCyl);
        this.ganzhiDate = ymdCyl(X.dayCyl++);
        this.jieqi = "";
        this.restDays = 0;
        if (sTerm(this.solarYear, (this.solarMonth - 1) * 2) == reymd(Y, "d")) {
            this.showInLunar = this.jieqi = solarTerm[(this.solarMonth - 1) * 2];
        }
        if (sTerm(this.solarYear, (this.solarMonth - 1) * 2 + 1) == reymd(Y, "d")) {
            this.showInLunar = this.jieqi = solarTerm[(this.solarMonth - 1) * 2 + 1];
        }
        if (this.showInLunar == "清明") {
            this.showInLunar = "清明节";
            this.restDays = 1;
        }
        this.solarFestival = sFtv1[reymd(Y, "MM") + reymd(Y, "dd")];
        if (typeof this.solarFestival == "undefined") {
            this.solarFestival = "";
        } else {
            if (/\*(\d)/.test(this.solarFestival)) {
                this.restDays = parseInt(RegExp.$1);
                this.solarFestival = this.solarFestival.replace(/\*\d/, "");
            }
        }
        this.showInLunar = (this.solarFestival == "") ? this.showInLunar : this.solarFestival;
        this.lunarFestival = sFtv2[this.lunarIsLeapMonth ? "00" : digit(this.lunarMonth) + digit(this.lunarDate)];
        if (typeof this.lunarFestival == "undefined") {
            this.lunarFestival = "";
        } else {
            if (/\*(\d)/.test(this.lunarFestival)) {
                this.restDays = (this.restDays > parseInt(RegExp.$1)) ? this.restDays : parseInt(RegExp.$1);
                this.lunarFestival = this.lunarFestival.replace(/\*\d/, "");
            }
        }
        if (this.lunarMonth == 12 && this.lunarDate == e(this.lunarYear, 12)) {
            this.lunarFestival = sFtv2["0100"];
            this.restDays = 1;
        }
        this.showInLunar = (this.lunarFestival == "") ? this.showInLunar : this.lunarFestival;
    }
    var jeLunar = function(y, m, d) {
        return new flunar(new Date(y, m, d));
    };
    return jeLunar;
});

/**
 * Created by sinarts on 17/1/11.
 */
;
(function(root, factory) {
    //amd
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else if (typeof exports === 'object') { //umd
        module.exports = factory();
    } else {
        root.jeCheck = factory(window.jQuery || $);
    }
})(this, function($) {
    $.fn.jeCheck = function(options) {
        return this.each(function() {
            return new jeCheck($(this), options || {});
        })
    };
    $.extend({
        jeCheck: function(elem, options) {
            return $(elem).each(function() {
                return new jeCheck($(this), options || {});
            })
        }
    });
    var jeCheck = function(elem, opts) {
        var config = {
            jename: "checkbox",
            radioCls: "je-radio", //radio最外层的样式
            checkCls: "je-check", //checkbox最外层的样式
            current: 'on', //被选中的样式
            disabled: "disabled", //被禁用的样式
            currDisa: "checkDisa", //被选中加禁用的样式
            attrName: ["jetext", "勾选"], //设置文字属性
            switchText: ["NO", "OFF"],
            icons: ['&#xe65c;', '&#xe63c;', '&#xe6a0;'],
            itemfun: function(elem) {}, //点击当前的回调，elem为当前点击的ID
            success: null //加载成功后的回调函数
        };
        this.opts = $.extend(config, opts || {});
        this.elCell = elem;
        this.init();
    };
    var jefn = jeCheck.prototype;
    jefn.init = function() {
        var _this = this,
            opts = _this.opts,
            thatCell = _this.elCell,
            inpCell = $(thatCell).find("input[jename=" + opts.jename + "]");
        $.each(inpCell, function() {
            var elthat = $(this);
            if (opts.jename == "switch") {
                _this.switchRadioCheck(elthat, opts.jename);
            } else {
                _this.radioCheck(elthat, opts.jename);
            }
        });
        //加载成功后的回调
        if ($.isFunction(opts.success) || opts.success != ("" || null)) {
            opts.success && opts.success(inpCell, opts.jename);
        }
    };
    jefn.switchRadioCheck = function(elem, elattr) {
        var _this = this,
            opts = _this.opts;
        if (elem.attr('type') == 'checkbox' || elem.attr('type') == 'radio') {
            var wrapTag = elem.attr('type') == 'checkbox' ? $('<ins class="' + opts.checkCls + '-switch"></ins>') : $('<ins class="' + opts.radioCls + '-switch"></ins>');
            var jename = elem.attr(opts.attrName[0]),
                typename = jename && jename.split(",");
            var swtB = $.isArray(typename) ? typename[1] : opts.switchText[1];
            //创建元素并获取文字
            var spanCls = "<span>" + swtB + "</span><em></em>";
            elem.attr('small') != undefined ? elem.wrap(wrapTag.addClass('small')).after(spanCls) : elem.wrap(wrapTag).after(spanCls);
            _this.checkedBind(elem, elattr);
        }
    }
    jefn.radioCheck = function(elem, elattr) {
        var _this = this,
            opts = _this.opts,
            wrapTag = "";
        //判断是否为多选或单选
        if (elem.attr('type') == 'checkbox' || elem.attr('type') == 'radio') {
            //包裹多选或单选
            if (elattr == 'chunk' && elem.attr('type') == 'checkbox') {
                wrapTag = $('<ins class="' + opts.checkCls + '-chunk"></ins>');
            } else {
                wrapTag = elem.attr('type') == 'checkbox' ? $('<ins class="' + opts.checkCls + '"></ins>') : $('<ins class="' + opts.radioCls + '"></ins>');
            }
            //创建元素并获取文字
            var emCls = "<em>" + (elem.attr('type') == 'checkbox' ? opts.icons[0] : opts.icons[1]) + "</em>",
                spanCls = elattr == 'chunk' ? "" : "<span class='" + (elem.attr('type') == 'checkbox' ? opts.checkCls : opts.radioCls) + "-text'>" + (elem.attr(opts.attrName[0]) != undefined ? elem.attr(opts.attrName[0]) : opts.attrName[1]) + "</span>";
            var emSpanHtml = emCls + spanCls;
            elem.wrap(wrapTag).after(emSpanHtml);
            _this.checkedBind(elem, elattr);
        }
    };
    jefn.checkedBind = function(elem, elattr) {
        var _this = this,
            opts = _this.opts,
            onCls = opts.current,
            thatCell = _this.elCell,
            //检查switch模式的选中状态
            onCheckSwitch = function(swelem, onCls) {
                var bool = null;
                if (elattr == 'switch') {
                    var jename = swelem.attr(opts.attrName[0]),
                        typename = jename && jename.split(",");
                    var swtA = $.isArray(typename) ? typename[0] : opts.switchText[0],
                        swtB = $.isArray(typename) ? typename[1] : opts.switchText[1];
                    if (swelem.is(':checked')) {
                        swelem.parent().addClass(onCls);
                        swelem.next().html(swtA);
                        bool = true;
                    } else {
                        swelem.parent().removeClass(onCls);
                        swelem.next().html(swtB);
                        bool = false;
                    }
                } else {
                    bool = _this.onSetStyle(swelem, onCls);
                }
                return bool;
            };
        elem.on('change', function() {
            var inpthis = $(this),
                rebl = null;
            if (inpthis.attr('type') == 'radio') {
                $(thatCell).find("input[jename=" + elattr + "]").each(function() {
                    rebl = onCheckSwitch($(this), onCls);
                })
            } else if (inpthis.attr('type') == 'checkbox') {
                rebl = onCheckSwitch(inpthis, onCls);
            }
            //点击当前的回调
            if ($.isFunction(opts.itemfun) || opts.itemfun != ("" || null)) {
                opts.itemfun && opts.itemfun(inpthis, rebl);
            }
        });
        //判断是否为选中
        if (elem.is(':checked')) {
            var jename = elem.attr(opts.attrName[0]),
                typename = jename && jename.split(","),
                swtA = $.isArray(typename) ? typename[0] : opts.switchText[0];
            elem.parent().addClass(opts.current);
            if (elattr == 'switch') {
                elem.next().text(swtA);
            } else {
                if (elem.attr('type') == 'radio') elem.next().html(opts.icons[2]);
            }
        }
        //判断是否为禁用
        if (elem.prop("disabled") == true) {
            elem.parent().removeClass(opts.current).addClass(opts.disabled);
        }
        //判断是否为选中加禁用
        if (elem.is(':checked') && elem.prop("disabled") == true) {
            elem.parent().addClass(opts.current).removeClass(opts.disabled).addClass(opts.currDisa);
        }
    };
    //设置点击后的样式
    jefn.onSetStyle = function(elem, cls) {
        var _this = this,
            opts = _this.opts,
            bool = null;
        if (elem.is(':checked')) {
            elem.parent().addClass(cls);
            if (elem.attr('type') == 'radio') elem.next().html(opts.icons[2]);
            bool = true;
        } else {
            elem.parent().removeClass(cls);
            if (elem.attr('type') == 'radio') elem.next().html(opts.icons[1]);
            bool = false;
        }
        return bool;
    };
    return jeCheck;
});

/**
 @Name : jeBox v1.5 弹层组件
 @Author: chen guojun
 @Date: 2017-06-26
 @QQ群：516754269
 @官网：http://www.jemui.com/jebox/ 或 https://github.com/singod/jeBox
 */
;
!(function(window, factory) {
    if (typeof define === "function" && define.amd) {
        define(factory);
    } else if (typeof module === "object" && typeof module.exports === "object") {
        module.exports = factory();
    } else {
        window.jeBox = factory();
    }
})(this, function() {
    var Jeobj = { endfun: {} },
        regPxe = /\px|em/g,
        ieBrowser = !-[1, ] ? parseInt(navigator.appVersion.split(";")[1].replace(/MSIE|[ ]/g, "")) : 9;
    //缓存常用字符
    var doms = ["jeBox", ".jeBox-wrap", ".jeBox-header", ".jeBox-content", ".jeBox-footer", ".jeBox-close", ".jeBox-maxbtn"];
    var jeBox = {
        version: "1.5",
        jeidx: Math.floor(Math.random() * 9e3)
    };
    var jeDialog = function(options) {
        var that = this;
        var config = {
            cell: "", // 独立ID,用于控制弹层唯一标识
            title: "提示信息", // 标题,参数一：提示文字，参数二：提示条样式  ["提示信息",{color:"#ff0000"}]
            content: "暂无内容！", // 内容
            boxStyle: {}, //设置弹层的样式
            closeBtn: true, // 标题上的关闭按钮
            closefun: null,
            maxBtn: false, //是否开启最大化按钮
            boxSize: ["auto", "auto"], // 参数一：弹层宽度，参数二： 弹层高度
            padding: "5px", // 自定义边距
            offset: ["auto", "auto"], //坐标轴
            type: 'dialog', // 显示基本层类型
            icon: 0, // 图标,信息框和加载层的私有参数
            button: [], // 各按钮
            btnAlign: "right", //btnAlign 按钮对齐方式  left center right
            time: 0, // 自动关闭时间(秒),0表示不自动关闭
            maskLock: true, // 是否开启遮罩层
            maskClose: true, // 点击遮罩层是否可以关闭
            maskColor: ["#000", .5], // 参数一：遮罩层颜色，参数二：遮罩层透明度
            isDrag: true, // 是否可以拖拽
            fixed: true, // 是否静止定位
            zIndex: 9999, // 弹层层级关系
            scrollbar: false, // 是否允许浏览器出现滚动条
            shadow: true, //拖拽风格
            success: null, // 层弹出后的成功回调方法
            endfun: null
        };
        that.config = $.extend({}, config, options);
        that.jeidx = (that.config.cell == "" || that.config.cell == undefined) ? ++jeBox.jeidx : that.config.cell.replace(/[#.]/, "");
        that.initView()
    };
    var jefn = jeDialog.prototype;

    //初始化并加载弹层骨架
    jefn.initView = function() {
        var that = this,
            opts = that.config,
            idx = that.jeidx,
            msgCell = opts.content,
            isType = opts.type,
            icons = opts.icon,
            lays = ['dialog', 'iframe', 'loading', 'tips'],
            conType = typeof msgCell === "object",
            msgType = msgCell[0] && msgCell[0].nodeType === 1,
            iconMsg = '<div class="jeBox-iconbox jeicon' + icons + '">' + msgCell + "</div>";
        Jeobj.scrollbar = opts.scrollbar;
        //判断ID是否已经存在
        if (opts.cell && $("#" + doms[0] + that.jeidx)[0]) return;
        switch (isType) {
            case lays[0]:
                opts.type = lays[0];
                if (typeof msgCell === "string") {
                    opts.content = icons !== 0 ? iconMsg : msgCell;
                } else if (msgType) {
                    opts.content = "";
                    //查询传入的位置
                    Jeobj["dispy" + idx] = msgCell.css("display");
                    Jeobj["prev" + idx] = msgCell.prev();
                    Jeobj["next" + idx] = msgCell.next();
                    Jeobj["parent" + idx] = msgCell.parent();
                    if (msgCell.css("display") == "none") msgCell.css("display", "block");
                }
                jeBox.closeAll(lays[0]);
                break;
            case lays[1]:
                opts.type = lays[1];
                var conMsg = conType ? msgCell : [msgCell || "http://www.jemui.com/", "auto"];
                opts.content = '<iframe scrolling="' + (conMsg[1] || "auto") + '" allowtransparency="true" id="jeboxiframe' + idx + '" name="' + idx + '" onload="this.className=\'\';" frameborder="0" width="100%" height="100%" src="' + conMsg[0] + '"></iframe>';
                jeBox.closeAll(lays[1]);
                break;
            case lays[2]:
                opts.type = lays[2];
                opts.content = '<div class="jeBox-loadbox jeload' + icons + '">' + msgCell + '</div>';
                jeBox.closeAll(lays[2]);
                break;
            case lays[3]:
                opts.type = lays[3];
                jeBox.closeAll(lays[3]);
                break;
        }
        if (opts.type == lays[3]) { //tips提示
            var tipW = $.isArray(opts.boxSize) ? opts.boxSize[0] : opts.boxSize,
                tipH = $.isArray(opts.boxSize) ? opts.boxSize[1] : opts.boxSize;
            var tipDiv = $("<div>", { "class": "jeBox-tips", "id": doms[0] + idx }).css({ width: tipW, height: tipH, 'z-index': opts.zIndex }).css(opts.boxStyle);
            $("body").append(tipDiv.append("<em></em><div class='jeBox-tipscon'>" + opts.content + "</div>"));
            var post = $(opts.cell).offset().top,
                posl = $(opts.cell).offset().left,
                tiptop, tipleft, edgecolor, aligngo, spac = opts.spacing,
                selfH = $(opts.cell).outerHeight(),
                selfW = $(opts.cell).outerWidth(),
                tipH = tipDiv.outerHeight(true),
                tipW = tipDiv.outerWidth(true);
            switch (opts.align) {
                case 'top':
                case 'bottom':
                    aligngo = opts.align == 'top' ? 'bottom' : 'top';
                    edgecolor = 'border-right-color', tipleft = posl;
                    tiptop = opts.align == 'top' ? (post - tipH - spac) : (post + selfH + spac);
                    break;
                case 'left':
                case 'right':
                    aligngo = opts.align == 'left' ? 'right' : 'left';
                    edgecolor = 'border-bottom-color', tiptop = post;
                    tipleft = opts.align == 'left' ? (posl - tipW - spac) : (posl + selfW + spac);
                    break;
            }
            tipDiv.css({ top: tiptop, left: tipleft });
            tipDiv.find("em").css(edgecolor, tipDiv.css('background-color')).css(aligngo, -8);
            tipDiv.attr("jetype", opts.type);
            that.btnCallback(tipDiv);
        } else {
            that.creatBox(function(cell) {
                if (msgType) {
                    cell.attr("jenode", msgCell.selector.toString());
                    //把已知的html片段包裹并插入到弹层中
                    cell.find(doms[3]).append(msgCell);
                }
                cell.attr("jetype", opts.type);
                that.setSize(cell);
                that.setPosition(cell);
                that.btnCallback(cell);
                //是否可拖动
                if (opts.isDrag) {
                    var wrapCell = cell,
                        titCell = cell.find(doms[2]);
                    that.dragLayer(wrapCell, titCell, 0.4, opts.shadow);
                };
            });
        }
    };
    //创建弹层骨架
    jefn.creatBox = function(callback) {
        var that = this,
            opts = that.config,
            idx = that.jeidx;
        //创建按钮模板
        var arrButton = opts.button,
            btnLen = arrButton.length;
        var btnHtml = function() {
            var btnStrs = btnLen != 0 ? function() {
                var btnArr = [];
                $.each(arrButton, function(i, val) {
                    btnArr.push('<button type="button" class="jeBox-btn' + i + '" jebtn="' + i + '" ' + (val.disabled == true ? "disabled" : "") + '>' + val.name + '</button>');
                });
                return btnArr.join("");
            }() : "";
            return '<div class="jeBox-footer">' + btnStrs + "</div>";
        }();
        var paddings = opts.padding,
            skinCell = opts.skinCell || "jeBox-anim";
        //创建默认的弹出层内容模板
        var templates = '<span class="jeBox-headbtn"><a href="javascript:;" class="jeBox-maxbtn" title="最大化"></a><a href="javascript:;" class="jeBox-close" title="&#20851;&#38381;"></a></span>' + '<div class="jeBox-header"></div>' + '<div class="jeBox-content" style="padding:' + (paddings != "" ? paddings : 0) + ';">' + opts.content + '</div>' + btnHtml;
        //创建弹窗外部DIV
        var getZindex = function(elem) {
                var maxZindex = 0;
                elem.each(function() {
                    maxZindex = Math.max(maxZindex, $(this).css("z-index"));
                });
                return maxZindex;
            },
            zIndexs = opts.zIndex;
        //计算层级并置顶
        var Zwarp = $(doms[1]).size() > 0 ? getZindex($(doms[1])) + 5 : zIndexs + 5,
            Zmask = $(doms[1]).size() > 0 ? getZindex($(doms[1])) + 2 : zIndexs,
            divBoxs = $("<div/>", { "id": doms[0] + idx, "class": doms[1].replace(/\./g, "") });
        $("body").append(divBoxs.append(templates));
        divBoxs.attr("jeitem", idx);
        divBoxs.css({ position: opts.fixed ? "fixed" : "absolute", "z-index": Zwarp });
        (parseInt(ieBrowser) < 9) ? divBoxs.addClass("jeBox-ies"): divBoxs.addClass(skinCell);
        jeBox.zIndex = parseInt(divBoxs.css("z-index"));
        !Jeobj.scrollbar && $("body").css("overflow", "hidden");
        //是否开启遮罩层
        if (opts.maskLock) {
            var maskBox = $("<div/>", { "id": "jemask" + idx, "class": "jeBox-mask" }),
                maskColor = opts.maskColor;
            $("body").append(maskBox);
            maskBox.css({ left: 0, top: 0, "background-color": maskColor[0], "z-index": Zmask, opacity: maskColor[1], filter: "alpha(opacity=" + maskColor[1] * 100 + ")" })
        };
        var titles = opts.title == false ? "" : (opts.title || config.title),
            titType = typeof titles === "object",
            isTitle = titles ? (titType ? titles[0] : titles) : "";
        divBoxs.find(doms[2]).html(isTitle).css({ "display": isTitle != "" ? "" : "none", "height": isTitle != "" ? "" : "0px" }).css(titType ? titles[1] : {});
        divBoxs.find(doms[4]).css({ "display": btnLen != 0 ? "block" : "none", "text-align": opts.btnAlign });
        divBoxs.find(doms[5]).css("display", opts.closeBtn ? "" : "none");
        divBoxs.find(doms[6]).css("display", opts.maxBtn ? "" : "none");
        callback && callback(divBoxs);
    };
    //设置弹层尺寸
    jefn.setSize = function(cell) {
        var that = this,
            opts = that.config,
            wrapWidth, wrapHeight, conWidth, conHeight,
            conCell = cell.find(doms[3]),
            areas = opts.boxSize,
            conPad = function(prop) { return parseInt(conCell.css(prop).replace(regPxe, "")) },
            conhead = Jeobj.conhead = cell.find(doms[2]).height(),
            confoot = Jeobj.confoot = cell.find(doms[4]).height(),
            winW = $(window).width(),
            winH = $(window).height(),
            Padtb = conPad("padding-top") + conPad("padding-bottom"),
            Padlr = conPad("padding-left") + conPad("padding-right"),
            Martb = conPad("margin-top") + conPad("margin-bottom"),
            Marlr = conPad("margin-left") + conPad("margin-right");
        var toSize = function(wval, fval) {
            return /^\d+%$/.test(fval.toString()) ? parseInt(wval * (fval.toString().replace("%", "") / 100)) :
                parseInt(fval.toString().replace(regPxe, ""));
        };
        if ($.isArray(areas)) {
            var fixW = areas[0],
                fixH = areas[1],
                bfW = toSize(winW, fixW),
                bfH = toSize(winH, fixH),
                nPerW = bfW >= winW ? winW : bfW,
                nPerH = bfH >= winH ? winH : bfH;
            //设置层的宽度
            if ($.type(fixW) === "number") {
                wrapWidth = bfW + Padlr + Marlr;
                conWidth = bfW;
            } else if (fixW == "auto") {
                wrapWidth = cell.outerWidth(true) + Padlr + Marlr;
                conWidth = cell.outerWidth(true);
            } else {
                wrapWidth = nPerW;
                conWidth = nPerW - Padlr - Marlr;
            }

            //设置层的高度
            if ($.type(fixH) === "number") {
                wrapHeight = bfH + Padtb + Martb;
                conHeight = bfH - conhead - confoot;
            } else if (fixH == "auto") {
                wrapHeight = cell.outerHeight(true);
                conHeight = cell.outerHeight(true) - Padtb - Martb - conhead - confoot;
            } else {
                wrapHeight = nPerH;
                conHeight = nPerH - Padtb - Martb - conhead - confoot;
            }
        }
        opts.maxBtn && cell.attr("area", [wrapWidth, wrapHeight, conWidth, conHeight]);
        cell.css({ "width": wrapWidth, height: wrapHeight }).css(opts.boxStyle);
        cell.find(doms[3]).css({ "width": conWidth, "height": conHeight });
    };
    //定位层显示的位置
    jefn.setPosition = function(cell) {
        var that = this,
            opts = that.config,
            Postr, elemtr, elembl, offsets = opts.offset,
            isOffsetArr = $.isArray(offsets),
            eleW = cell.width(),
            eleH = cell.height(),
            Postr = offsets[0],
            Posbl = offsets[1],
            winWidth = $(window).width(),
            winHeight = $(window).height();
        //设置位置
        elemtr = (isOffsetArr && /^\@/.test(Postr)) ? Postr.replace(/\@/g, "") :
            ((Postr == "auto") ? (winHeight - eleH) / 2 : /^\d+%$/.test(Postr) ? Postr : Postr.replace(regPxe, ""));
        elembl = (isOffsetArr && /^\@/.test(Posbl)) ? Posbl.replace(/\@/g, "") :
            ((Posbl == "auto") ? (winWidth - eleW) / 2 : /^\d+%$/.test(Posbl) ? Posbl : Posbl.replace(regPxe, ""));
        //判断设置位置类型
        cell.css((isOffsetArr && (/^\@/.test(Postr) || /^\@/.test(Posbl))) ? { "right": elemtr, "bottom": elembl } : { "top": elemtr, "left": elembl });
        if (opts.maxBtn) {
            cell.attr("offset", [elemtr, elembl]);
        }
    };
    //各关闭按钮的事件
    jefn.btnCallback = function(cell) {
        var that = this,
            opts = that.config,
            idx = that.jeidx,
            maxBtn = cell.find(doms[6]),
            times = opts.time,
            btns = opts.button,
            offsets = opts.offset;
        if (opts.success) {
            if (opts.type == "iframe") {
                cell.find("iframe").on("load", function() {
                    config.success(cell, idx);
                });
            } else {
                opts.success(cell, idx);
            }
        };
        if (opts.type != "tips") {
            // 按钮队列
            if (!$.isArray(btns)) btns = btns ? [btns] : [];
            //自动关闭
            times <= 0 || setTimeout(function() {
                jeBox.close(idx);
            }, times * 1e3);

            //关闭按钮事件
            if (opts.closeBtn) {
                cell.find(doms[5]).on("click", function() {
                    var close = opts.closefun && opts.closefun(idx);
                    close === false || jeBox.close(idx);
                });
            }
            //最大化按钮
            if (opts.maxBtn) {
                maxBtn.bind("click", function() {
                    if (maxBtn.hasClass("revert")) {
                        maxBtn.removeClass("revert");
                        jeBox.restore(idx);
                        $(this).attr("title", "最大化");
                    } else {
                        maxBtn.addClass("revert");
                        jeBox.full(idx);
                        $(this).attr("title", "还原");
                    }
                });
            }
            //更多按钮
            if (btns.length > 0) {
                cell.find(doms[4] + " button").on("click", function() {
                    var index = parseInt($(this).attr("jebtn"));
                    if (index === 0) {
                        btns[0]["callback"] ? btns[0]["callback"](idx, cell) : jeBox.close(idx, cell);
                    } else if (index > 0) {
                        var close = btns[index]["callback"] && btns[index]["callback"](idx, cell);
                        close === false || jeBox.close(idx);
                    }
                });
            }
            //点遮罩关闭
            if (opts.maskClose) {
                $("#jemask" + idx).on("click", function() {
                    jeBox.close(idx);
                });
            }
            //自适应
            $(window).resize(function() {
                if ($.isArray(offsets) && (/^\@/.test(offsets[0]) || /^\@/.test(offsets[1]))) {
                    cell.css({ "top": "", "left": "" });
                }
                that.setPosition(cell);
            });
        }
        opts.endfun && (Jeobj.endfun[idx] = opts.endfun);
    };
    //拖拽事件
    jefn.dragLayer = function(warpCell, titCell, opacityVal, isShadow) {
        var that = this,
            isIES = !-[1];
        titCell = titCell || warpCell;
        var tmpX = tmpY = 0;
        that.isMoveable = false;
        titCell.css("cursor", "move");
        if (isShadow) {
            that.isShadow = isShadow ? isShadow == true || isShadow == false ? isShadow : false : false;
            if (that.isShadow) that.opacity = opacityVal;
        } else {
            that.opacity = 100, that.isShadow = false;
        }
        titCell.on("mousedown", function(event) {
            var event = event || window.event;
            var tempLayer = $("<div/>", { "id": "jeBox-moves", "class": "jeBox-moves" }),
                warpLeft = warpCell.css("left"),
                warpTop = warpCell.css("top");
            var tempLayerCon = $("<div/>", { class: "movescon" });
            //只允许通过鼠标左键进行拖拽,IE鼠标左键为1 FireFox为0
            if (isIES && event.button != 1 || isIES && event.button == 0) return false;
            //创建临时拖动层
            if (that.isShadow) {
                tempLayer.css({
                    width: (warpCell.outerWidth() - 4),
                    height: (warpCell.outerHeight() - 4),
                    left: warpLeft,
                    top: warpTop,
                    "z-index": parseInt(warpCell.css("z-index")) + 10
                });
                $("body").append(tempLayer.append(tempLayerCon));
            }
            that.isMoveable = true;
            tmpX = event.pageX - warpLeft.replace(regPxe, "");
            tmpY = event.pageY - warpTop.replace(regPxe, "");
            //FireFox 去除容器内拖拽图片问题
            if (event.preventDefault) {
                event.preventDefault();
                event.stopPropagation();
            }
            $(document).on("mousemove", function(event) {
                if (!that.isMoveable) return;
                window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
                //控制元素不被拖出窗口外
                var event = event || window.event,
                    elemCopy = that.isShadow ? tempLayer : warpCell,
                    DmpX = event.pageX - tmpX,
                    DmpY = event.pageY - tmpY,
                    maxW = $(window).width() - warpCell.outerWidth(),
                    maxH = $(window).height() - warpCell.outerHeight();
                DmpX <= 0 && (DmpX = 0);
                DmpY <= 0 && (DmpY = 0);
                DmpX >= maxW && (DmpX = maxW);
                DmpY >= maxH && (DmpY = maxH);
                elemCopy.css({ "top": DmpY, "left": DmpX });
            }).on("mouseup", function() {
                if (that.isMoveable) {
                    that.isMoveable = false;
                    tmpX = tmpY = 0;
                    warpCell.css({ "right": "", "bottom": "" });
                    if (that.isShadow) {
                        //判断并把虚框的位置信息传给弹层
                        warpCell.css({ "top": tempLayer.css("top"), "left": tempLayer.css("left") });
                        //判断并删除新创建的虚框
                        $("#jeBox-moves").remove();
                    }
                    if ($(window).width() != warpCell.outerWidth()) {
                        warpCell.attr("offset", [warpCell.css("top").replace(regPxe, ""), warpCell.css("left").replace(regPxe, "")]);
                    }
                }
            });
        });
    };
    // 让传入的元素在对话框关闭后可以返回到原来的地方
    Jeobj.backInSitu = function(elem, jePrev, jeNext, jeParent, jeDispy) {
        if (jePrev.length > 0 && jePrev.parent()) {
            jePrev.after(elem);
        } else if (jeNext.length > 0 && jeNext.parent()) {
            jeNext.before(elem);
        } else if (jeParent.length > 0) {
            jeParent.append(elem);
        }
        elem.css("display", jeDispy);
        //this.backInSitu = null;
    };
    //弹层核心
    jeBox.open = function(opts) {
        var jeShow = new jeDialog(opts || {});
        return jeShow.jeidx;
    };
    //关闭指定层
    jeBox.close = function(idx) {
        var boxCell = $("#" + doms[0] + idx),
            maskCell = $("#jemask" + idx);
        var nodeCell = boxCell.attr("jenode"),
            arr = ["prev" + idx, "next" + idx, "parent" + idx, "dispy" + idx];
        if (!boxCell) return;
        if ($(nodeCell).size() > 0 && $(nodeCell)[0].nodeType === 1) {
            Jeobj.backInSitu($(nodeCell), Jeobj[arr[0]], Jeobj[arr[1]], Jeobj[arr[2]], Jeobj[arr[3]]);
        };
        boxCell && boxCell.remove();
        maskCell && maskCell.remove();
        $("body").css("overflow") == "hidden" && $("body").css("overflow", "");
        $.each(arr, function(i, val) {
            delete Jeobj[val];
        });
        typeof Jeobj.endfun[idx] === 'function' && Jeobj.endfun[idx]();
        delete Jeobj.endfun[idx];
    };
    //关闭所有层
    jeBox.closeAll = function(type) {
        $.each($(doms[1]), function() {
            var that = $(this);
            var istype = type ? (that.attr('jetype') === type) : 1;
            istype && jeBox.close(parseInt(that.attr("jeitem")));
            istype = null;
        });
    };
    //最常用提示层
    jeBox.msg = function(content, options, end) {
        var type = $.isFunction(options);
        if (type) end = options;
        return jeBox.open($.extend({
            title: false,
            content: content,
            padding: "10px",
            skinCell: "jeBox-animMsg",
            time: 3,
            maskLock: false,
            closeBtn: false,
            end: end
        }, !type && function() {
            options = options || {};
            return options;
        }()));
    };
    jeBox.alert = function(content, options, yes) {
        var type = $.isFunction(options);
        if (type) yes = options;
        return jeBox.open($.extend({
            content: content,
            button: [{ name: '确定', callback: yes }]
        }, type ? {} : options));
    };
    jeBox.loading = function(icon, content, options) {
        return jeBox.open($.extend({
            title: false,
            closeBtn: false,
            type: 'loading',
            skinCell: "jeBox-animLoad",
            maskLock: false,
            content: content == undefined ? "" : content,
            icon: icon || 1
        }, options));
    };
    //tip提示泡泡
    jeBox.tips = function(cell, content, options) {
        return jeBox.open($.extend({
            cell: cell,
            type: 'tips',
            content: content == undefined ? "" : content,
            align: "top", //提示层的箭头方向
            boxStyle: { 'background-color': "#5eb95e" }, //提示层的风格，参数为提示边框颜色
            spacing: 10 //默认为箭头距离对象的尺寸
        }, options || {}));
    };
    //改变当前弹层title
    jeBox.title = function(name, idx) {
        $("#" + doms[0] + idx).find(doms[2]).html(name);
    };
    //改变当前弹层内容
    jeBox.content = function(content, idx) {
        $("#" + doms[0] + idx).find(doms[3]).html(content);
    };
    //还原
    jeBox.restore = function(index) {
        var boxCell = $("#" + doms[0] + index),
            conCell = boxCell.find(doms[3]),
            revArea = boxCell.attr("area").split(/,/g),
            revOffset = boxCell.attr("offset").split(/,/g);
        $("body").css('overflow', Jeobj.scrollbar == false ? 'hidden' : '');
        boxCell.css({
            width: revArea[0],
            height: revArea[1],
            top: revOffset[0] + "px",
            left: revOffset[1] + "px",
            right: "",
            bottom: ""
        });
        conCell.css({ width: revArea[2], height: revArea[3] });
    };
    //全屏
    jeBox.full = function(index) {
        var timer, boxCell = $("#" + doms[0] + index),
            conCell = boxCell.find(doms[3]);
        $("body").css('overflow', 'hidden');
        clearTimeout(timer);
        timer = setTimeout(function() {
            boxCell.find(doms[6]).addClass("revert");
            var isfix = boxCell.css('position') === 'fixed',
                offset = boxCell.attr("offset").split(","),
                docWidth = $(window).width(),
                docHeight = $(window).height(),
                conW = conCell.outerWidth(true) - conCell.width(),
                conH = conCell.outerHeight(true) - conCell.height(),
                headHeight = boxCell.find(doms[2]).outerHeight(true),
                footHeight = boxCell.find(doms[4]).outerHeight(true);
            boxCell.css({
                width: docWidth,
                height: docHeight,
                top: isfix ? 0 : offset[0],
                left: isfix ? 0 : offset[1],
                right: "",
                bottom: ""
            });
            conCell.css({
                width: docWidth - conW,
                height: docHeight - conH - headHeight - footHeight
            });
        }, 50);
    };
    //获取子iframe的DOM
    jeBox.frameCell = function(selector, index) {
        index = index || $(".jeboxiframe").attr("jeitem");
        return $("#" + doms[0] + index).find("iframe").contents().find(selector);
    };
    //得到当前iframe层的索引，子iframe时使用
    jeBox.frameIndex = function(name) {
        return $("#" + doms[0] + name).attr("jeitem");
    };
    //重置iframe url
    jeBox.frameUrl = function(idx, url) {
        $("#" + doms[0] + idx).find("iframe").attr("src", url);
    };

    return jeBox
});

/**
 * Created by SinArts on 2017/4/1.
 */
(function(root, factory) {
    //amd
    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        //umd
        module.exports = factory();
    } else {
        root.jeAccordion = factory(window.$ || $);
    }
})(this, function($) {
    var jeAccordion = function(elem, opts) {
        var config = {
            accIndex: 1, //表示展开第几个，如果为0时全部展开
            titCell: ".je-panel-title", //折叠面板标题的类名，可以是tag也可以是class
            conCell: ".je-panel-content", //折叠面板内容的类名，可以是tag也可以是class
            currCell: "current", //被选中的面板变化
            multiple: true, //为true时展开当前，收起其他
            itemfun: function(thistit, conelem, isopen) {}, //每次点击后的回调函数，thistit为当前标题DOM，conelem为内容DOM，isopen判断是否为展开状态
            success: function(alltit, conelem) {} //加载成功后的回调函数，alltit为所有标题DOM，conelem为内容DOM
        };
        this.opts = $.extend(true, config, opts || {});
        this.elCell = elem;
        this.init();
    };
    $.fn.jeAccordion = function(options) {
        return this.each(function() {
            return new jeAccordion($(this), options || {});
        });
    };
    $.extend({
        jeAccordion: function(elem, options) {
            return $(elem).each(function() {
                return new jeAccordion($(this), options || {});
            });
        }
    });
    jeAccordion.prototype.init = function() {
        var that = this,
            opts = that.opts,
            idx = parseInt(opts.accIndex) - 1,
            titCell = opts.titCell,
            conCell = opts.conCell,
            currCell = opts.currCell,
            titLi = that.elCell.find(titCell),
            eqIndex = that.elCell.children().eq(idx),
            menuelem = that.elCell.find(conCell);
        //展开第几个
        if (idx >= 0) {
            eqIndex.children(titCell).addClass(currCell);
            eqIndex.children(conCell).show();
        } else {
            titLi.addClass(currCell);
            menuelem.show();
        }

        //绑定事件
        titLi.on("click", function() {
            var _this = $(this),
                next = _this.next(),
                isacc = false,
                partitCell = _this.parent().children(titCell);
            next.slideToggle();
            if (partitCell.hasClass(currCell)) {
                partitCell.removeClass(currCell);
                isacc = false;
            } else {
                partitCell.addClass(currCell);
                isacc = true;
            }

            if (opts.multiple) {
                that.elCell.find(conCell).not(next).slideUp().parent().children(titCell).removeClass(currCell);
            };
            //点击选中后的回调
            if (opts.itemfun != undefined && $.isFunction(opts.itemfun)) {
                opts.itemfun(_this, menuelem, isacc);
            }
        });

        //加载成功后的回调
        if (opts.success != undefined && $.isFunction(opts.success)) {
            opts.success && opts.success(titLi, menuelem);
        }
    };
    return jeAccordion;
});